Yeah, you need an "id" field to do that and "ORDER BY" it.  It's a 
benefit/limitation of SQL -- save time by giving random rows, or spend time 
sorting them.

Something that you should be wary of though...

If you do this:

    INSERT INTO table (id) values (1,2,3,4...10);

Your select would be:

    SELECT id FROM table LIMIT 10 ORDER BY id ASC;

However...

SqlAlchemy works like this:

    `.flush()` will write to the database
    `.commit()` will write to the database and commit the transaction

if you select/query after a commit(), you're in a new transaction.  You may 
need to use some other markers or track objects differently so that your 
"last 10" objects are related to the last 10 objects YOU inserted and not 
ones that anyone could have stored in the table since you stored yours. 



-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to