Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a seed for a query #1575

Open
kchou496 opened this issue Jan 28, 2025 · 0 comments
Open

Setting a seed for a query #1575

kchou496 opened this issue Jan 28, 2025 · 0 comments

Comments

@kchou496
Copy link

Hello,
Trying to take a consistent sample from a Redshift database by setting a seed but none of the below methods have worked. Would appreciated some help or guidance on how to do so, thanks!

db_query <- db_tbl %>%
filter(rand() < 0.1) %>%
sql_render() %>%
paste("set seed to 0.5", .)
set.seed(123)
db_tbl %>%
filter(rand() < 0.1) %>%
tally

Have tried suggestions from these threads but have not worked.
https://forum.posit.co/t/how-to-set-a-seed-for-dplyr-sql/167264
https://stackoverflow.com/questions/52848079/setting-a-seed-with-dbplyr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant