Re: How to delete with order_by and limit in core?

2015-11-07 Thread vitaly numenta
Thank you Michael. I was hoping to do it the native sqlalchemy way, because my function takes an sqlalchemy-based predicate that needs to be used in this and another query, so I was hoping to be able to do things natively using pure sqlalchemy constructs in order to share this predicate.

Re: How to delete with order_by and limit in core?

2015-11-07 Thread Mike Bayer
we just had nearly the identical problem here where we hit the bizarre fact that LIMIT won't work in the correlated subquery, and we went with a temp table. On 11/07/2015 02:27 PM, vitaly numenta wrote: > Thank you Michael. I was hoping to do it the native sqlalchemy way, > because my function

How to delete with order_by and limit in core?

2015-11-06 Thread vitaly numenta
Hi, I am using sqlalchemy core with the mysql dialect. Mysql supports DELETE with ORDER BY and LIMIT: DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [PARTITION (partition_name,...)] [WHERE where_condition] [ORDER BY ...] [LIMIT row_count] However, I can't seem to figure

Re: How to delete with order_by and limit in core?

2015-11-06 Thread vitaly numenta
I also tried to do this via subquery, but MySQL apparently doesn't support subqueries with LIMIT: NotSupportedError: (NotSupportedError) (1235, "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'") 'DELETE FROM twitter_tweets WHERE twitter_tweets.uid IN (SELECT