Setting a seed for a query
kchou496 opened this issue · comments
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