[sqlalchemy] Re: Session().execute(...) with parameter syntax error exception

2007-12-26 Thread Michael Bayer
On Dec 25, 2007, at 2:54 PM, jerryji wrote: However, the following parameterized version fails -- result = model.Session.execute(select * from labels where labelid=:labelid, {'labelid':10}, mapper=model.Label) with the following syntax error exception -- ... heya - the generic

[sqlalchemy] Objects are stored in DB when nobody asks to do so

2007-12-26 Thread Denis S. Otkidach
The following code fails on the last assert statement (SQLAlchemy 0.4.1): ---8--- from __future__ import with_statement import sqlalchemy as sa, logging from sqlalchemy.orm import mapper, sessionmaker logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) logging.basicConfig() class

[sqlalchemy] Re: Session().execute(...) with parameter syntax error exception

2007-12-26 Thread jerryji
Hi Michael, Thank you very much for the enlightenment. In this case, I think the SQLAlchemy 0.4 documentation needs a little update: under section Using SQL Expressions with Sessions (http:// www.sqlalchemy.org/docs/04/session.html#unitofwork_sql) -- Session = sessionmaker(bind=engine,

[sqlalchemy] Re: Objects are stored in DB when nobody asks to do so

2007-12-26 Thread Michael Bayer
On Dec 26, 10:15 am, Denis S. Otkidach [EMAIL PROTECTED] wrote: All modified objects are saved for each transaction and I see no way to control this. Am I right? There is a lot of cases when such behavior in unacceptable. Is it intended or a bug? the way around this depends on what you're

[sqlalchemy] Re: Objects are stored in DB when nobody asks to do so

2007-12-26 Thread Denis S. Otkidach
On Dec 26, 2007 6:29 PM, Michael Bayer [EMAIL PROTECTED] wrote: yet another scenario, you want to use transactions that are independent of session flushes. To accomplish this, use engine- or connection-level transactions, as described in the second half of