On 4/1/15 1:21 PM, Simon Beertree wrote: > Hi all, > > I have two classes, Product and Price, that have a many-to-many > relation through a secondary table (see attached test file). I'm > trying to delete all Prices that are not related to any Product. I > would expect the last query in the file to produce something like > > DELETE prices FROM prices LEFT OUTER JOIN current_prices ON prices.id > = current_prices.price_id WHERE current_prices.product_id IS NULL
SQLAlchemy has no support for this syntax. See issue https://bitbucket.org/zzzeek/sqlalchemy/issue/959/support-mysql-delete-from-join, as well as the just-today issue https://bitbucket.org/zzzeek/sqlalchemy/issue/3349/queryjoin-is-silently-ignored-within. > > > I'm seeing this on 1.0.0b4 and on 0.9.8 with Python 2.7.3 on Debian 7, > in sqlite as well as on MySQL. What am I doing wrong? This syntax is a non-standard syntax specific to MySQL. It will not work in SQLite (see http://sqlite.org/lang_delete.html - no JOIN there). > > Thanks, Simon > > -- > 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 > <mailto:sqlalchemy+unsubscr...@googlegroups.com>. > To post to this group, send email to sqlalchemy@googlegroups.com > <mailto:sqlalchemy@googlegroups.com>. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- 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.