dimanche 10 juillet 2016

How to set random seed in sqlalchemy.sql.expression.func.random() in python?

I would like to set a random seed when shuffling a sqlalchmy query result using order_by to get always the same query result:

my_query.order_by(func.random())

I could not find how to do it in the documentation. I tried it with

my_query.order_by(func.random(random_seed=1))
my_query.order_by(func.random(random_state=1))

but both didn't work. Thank you in advance for any idea/hint!

All best, Lea




Aucun commentaire:

Enregistrer un commentaire