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 not
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 can
On Oct 3, 2013 9:40 AM, "Dhananjay Nene" wrote:
>
> On Thu, Oct 3, 2013 at 8:19 AM, Mandar Vaze / मंदार वझे
> 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 related) forum that I can't wait to
On Fri, Oct 4, 2013 at 4:30 PM, Saager Mhatre wrote:
> On Oct 3, 2013 9:40 AM, "Dhananjay Nene" wrote:
>>
>> On Thu, Oct 3, 2013 at 8:19 AM, Mandar Vaze / मंदार वझे
>> wrote:
>> > Downloaded it, bit not used it, yet. (still using vim)
>> > But I have heard so much praise about pycharm from every