[sqlalchemy] Re: Random result

2008-08-25 Thread Ants Aasma
order by rand() doesn't scale too well unfortunately. http://www.depesz.com/index.php/2007/09/16/my-thoughts-on-getting-random-row/ has some better approaches. It's postgres specific but the approach should be generalizable by moving logic to client side. On Aug 23, 8:30 pm, GustaV [EMAIL

[sqlalchemy] Re: Random result

2008-08-23 Thread Michael Bayer
On Aug 23, 2008, at 12:10 PM, GustaV wrote: Hi all, Really, you do an amazing job on that stuff, it's a pleasure to work with! A short question though. It's possible to get a random order on selects in mysql using the RAND() in parameter of ORDER BY. I know similar (but different) was

[sqlalchemy] Re: Random result

2008-08-23 Thread GustaV
Ok, I wanted to know if there was a way to do it with no database specific code. Then you are right : I'll first query the result count (unknown a priori) and then use a random python generated offset. If anyone has a better idea (in 1 request only), that would be great! On 23 août, 18:34,