Re: [BangPypers] Getting a random record from Database . The best strategy.

2013-10-04 Thread Dhruv Baldawa
from sqlalchemy.sql.expression import func random_row = session.query(YourModel).order_by(func.random()).first() this is equivalent to: SELECT * FROM my_table ORDER BY RAND() LIMIT 1; http://www.kavoir.com/2009/03/sql-randomly-shuffle-rows-or-records-reorder-them-in-a-random-order.html I have

Re: [BangPypers] Getting a random record from Database . The best strategy.

2013-10-04 Thread s|s
An ideal situation is to use predictable test interfaces. Hence ideally you should have sequence of inserts and updates and selects at end of which you should be able to verify that database logic is consistent with your expectations. But if random records query is a requirement, at outset you

Re: [BangPypers] the pyCharm from Jetbrains has been opensourced i.e. its free now!

2013-10-04 Thread Saager Mhatre
On Oct 3, 2013 9:40 AM, Dhananjay Nene dhananjay.n...@gmail.com wrote: On Thu, Oct 3, 2013 at 8:19 AM, Mandar Vaze / मंदार वझे mandarv...@gmail.com wrote: Downloaded it, bit not used it, yet. (still using vim) But I have heard so much praise about pycharm from everyone in every (python

Re: [BangPypers] the pyCharm from Jetbrains has been opensourced i.e. its free now!

2013-10-04 Thread Dhananjay Nene
On Fri, Oct 4, 2013 at 4:30 PM, Saager Mhatre saager.mha...@gmail.com wrote: On Oct 3, 2013 9:40 AM, Dhananjay Nene dhananjay.n...@gmail.com wrote: On Thu, Oct 3, 2013 at 8:19 AM, Mandar Vaze / मंदार वझे mandarv...@gmail.com wrote: Downloaded it, bit not used it, yet. (still using vim) But