I'm trying to run the following sql using sqlalchemy ORM -
"delete from feed_items where feed_id=27 order by published_on asc
limit 10;"
I tried -
session.query(FeedItem).filter_by(feed_id=27).order_by
(FeedItem.published_on.asc()).limit(10).delete()
But this is deleting all rows instead of limiting the deletion to 10
rows. This was unexpected.
I also tried -
connection.execute(feed_items_table.delete().where
(feed_items_table.c.feed_id == 27).order_by
(feed_items_table.c.published_on.asc()).limit(10))
This throws an error saying order_by is not an attribute of Delete.
Is engine.execute(""delete from feed_items where feed_id=27 order by
published_on asc limit 10") the only option?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---