[sqlalchemy] AttributeError: 'Preprocess' object has no attribute 'detach' during Session.close

2011-05-03 Thread Torsten Landschoff
Hi *, has somebody seen this error and maybe an idea how I ended up triggering it? ;-) File /home/dynamore/loco2/deploy/linux64_rhel5.4/build/pyi.linux2/loco2/outPYZ1.pyz/sqlalchemy.orm.session, line 746, in close File

[sqlalchemy] Re: add_column for subselects.

2011-05-03 Thread prinzdezibel
The undesired cross join (cartesian product) happend because I involved Column objects in a filter statement (the filter statement is not shown in the original example). Changing it to use the mapped attributes solved the problem in another way: Instead of moving the CASE to the subselect it

Re: [sqlalchemy] Re: add_column for subselects.

2011-05-03 Thread Michael Bayer
hi Michael - note your original desired query is achievable by joining to a subquery instead of the entity, following the style of the example at http://www.sqlalchemy.org/docs/orm/tutorial.html#using-subqueries. On May 3, 2011, at 6:07 AM, prinzdezibel wrote: The undesired cross join

Re: [sqlalchemy] Re: API that allows me to do additional database operations just before insert execution for SQL Expression

2011-05-03 Thread Michael Bayer
On May 3, 2011, at 3:22 AM, bool wrote: of course...just return the default execution as illustrated at http://www.sqlalchemy.org/docs/core/interfaces.html#sqlalchemy.interf... . Mike, I want to return from the below method *without* actually executing the insert. I think if I

Re: [sqlalchemy] AttributeError: 'Preprocess' object has no attribute 'detach' during Session.close

2011-05-03 Thread Michael Bayer
It would appear as though a mapped class, I'm assuming called Preprocess, is being interpreted as an instance state, an internal ORM construct that would normally be attached to the mapped object.I'm not familiar offhand with any documented usage which could cause that. If you were to

[sqlalchemy] Re: API that allows me to do additional database operations just before insert execution for SQL Expression

2011-05-03 Thread bool
Thanks Mike for your views. Basically I wanted to execute the statement explicitly along with the other updates I wanted to do in a transaction and return None. So I am basically stuck with my use-case. I want to do some additional updates whenever an insert is done by the user. And these

Re: [sqlalchemy] Re: API that allows me to do additional database operations just before insert execution for SQL Expression

2011-05-03 Thread Michael Bayer
On May 3, 2011, at 12:12 PM, bool wrote: Thanks Mike for your views. Basically I wanted to execute the statement explicitly along with the other updates I wanted to do in a transaction and return None. I'm gathering, even though it hasn't been specified throughout these messages, that you

[sqlalchemy] SQLAlchemy 0.6.7 bug with mssql Datetime2

2011-05-03 Thread Andrew Sayman
I've recently come across a problem where SQLAlchemy was tossing an error when querying on mssql tables that had a datetime2 type. The error was this: File sqlalchemy\types.py, line 1361, in adapt return impltype(timezone=self.timezone) AttributeError: 'DATETIME2' object has no attribute

[sqlalchemy] Re: Query results not Integers

2011-05-03 Thread Daniel Holth
The query is simply returning rows with one column. For example session.query(X.a, X.b).all() would return a potentially less surprising list rows with two columns. The rows can be indexed by name or number. The 'L' is just Python telling you it is a long integer. -- You received this message

Re: [sqlalchemy] SQLAlchemy 0.6.7 bug with mssql Datetime2

2011-05-03 Thread Michael Bayer
thanks - this is reported as ticket #2159 and is only in 0.6. 0.7 rewrite the adapt() methodology and added tests for all types. On May 3, 2011, at 3:13 PM, Andrew Sayman wrote: I've recently come across a problem where SQLAlchemy was tossing an error when querying on mssql tables that had