That's a MySQL specific syntax you might be better off not using, perhaps you 
could say "delete from table where id in (select id from table order by 
timestamp limit 10)".

To get the exact statement, it's probably easiest just to emit the string SQL.  
If you wanted the sqlalchemy.sql.delete() construct to do it you'd need to 
subclass Delete, add order_by() and limit() to it, and augment its compilation 
as described in http://www.sqlalchemy.org/docs/core/compiler.html


On Jun 13, 2011, at 10:10 AM, Moshe C. wrote:

> Hi,
> I am using Sqlalchemy 0.6.5 .
> 
> How do I generate the following statement usin Sqlalchemy expressions
> (not ORM).
> 
> DELETE FROM table ORDER BY timestamp LIMIT 10;
> 
> TIA
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to