I get an OperationalError trying to use tuple_ and in_ in a query with a Sqlite db.
This is the query (select the distinct "id_acq - id_centr" couples not already present in another table) query = model.Session.query( Dato.id_elab, Acquisizione.id_centr)\ .filter(Dato.id_acq==Acquisizione.id_acq)\ .distinct()\ .filter(~tuple_(Dato.id_elab, Acquisizione.id_centr)\ .in_(select([Sensore.id_elab, Sensore.id_centr]))) I get this error: OperationalError: (OperationalError) near ",": syntax error u'SELECT DISTINCT dati.id_elab AS dati_id_elab, acquisizioni.id_centr AS acquisizioni_id_centr FROM dati, acquisizioni WHERE dati.id_acq = acquisizioni.id_acq AND (dati.id_elab, acquisizioni.id_centr) NOT IN (SELECT sensori.id_elab, sensori.id_centr FROM sensori)' () I guess the ',' cited in error is the one on the 3rd row Now I wonder if it's a Sqlite limitation, the SQL string seems correct to me. Any advice? Thanks for your support -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.