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, transactional=True) sess = Session() result = sess.execute("select * from table where id=:id", {'id':7}) Shouldn't the sess.execute(...) line become -- result = sess.execute(text("select * from table where id=:id"), {'id': 7}) Thanks. Jerry On Dec 26, 9:56 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > 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" textual bind params i.e. ":someparam" apply to the > "sql.text()" construct, whereas a plain string doesnt get processed at > all, so do it like Session.execute(text("select * from foo where > x=:label"), {<params>}, ...). > > - mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---