[sqlalchemy] Re: Operational Error raised by except_

2011-02-22 Thread neurino
I guess since, I learn it now, EXCEPT is not supported by MySQL... I guess I'll have to change my query at all... On Feb 22, 12:57 pm, neurino neur...@gmail.com wrote: I have now problems with except_ in MySQL: the code that worked flawlessly in sqlite now causes an error, seems right after

Re: [sqlalchemy] Re: Operational Error raised by except_

2011-02-22 Thread neurino
Something like this: stmt = Session.query(model.ViewOpt.id_cu, model.ViewOpt.id_meas) \ .filter(model.ViewOpt.id_view==1).subquery() query = Session.query(model.Sensor) \ .outerjoin((stmt, and_(model.Sensor.id_cu==stmt.c.id_cu,

[sqlalchemy] Re: Operational Error raised by except_

2011-01-13 Thread neurino
Thanks Michael, just for following readers I precise the ORDER BY clause causing the OperationalError is the one coming *before* the EXCEPT so I had to add .order_by(None) to the first query, now it looks like: Session.query(model.Sensor) \ .order_by(None) \ .except_(

[sqlalchemy] Re: Operational Error raised by except_

2011-01-12 Thread neurino
I need always the same order_by in all app and it could be subject of modification and / or integration in the near future so which better place than mapper to define it once instead of any time I do a query? Anyway do you think there are alternate paths to get `all sensors but already choosen`

Re: [sqlalchemy] Re: Operational Error raised by except_

2011-01-12 Thread Michael Bayer
On Jan 12, 2011, at 8:46 AM, neurino wrote: I need always the same order_by in all app and it could be subject of modification and / or integration in the near future so which better place than mapper to define it once instead of any time I do a query? It sounds like the ordering here is for

[sqlalchemy] Re: Operational Error raised by except_

2011-01-12 Thread neurino
Well as I wrote ordering involves everything, also forms creation with formalchemy (make a select where all sensors are ordered that way etc) anyway I understand your point of view. quickest is a where sensor id not in (query), as a simple WHERE clause Problem comes when Sensor primary key is

Re: [sqlalchemy] Re: Operational Error raised by except_

2011-01-12 Thread Michael Bayer
On Jan 12, 2011, at 11:20 AM, neurino wrote: Well as I wrote ordering involves everything, also forms creation with formalchemy (make a select where all sensors are ordered that way etc) anyway I understand your point of view. quickest is a where sensor id not in (query), as a simple WHERE