3 messages in com.googlegroups.sqlalchemy[sqlalchemy] Session().execute(...) w...| From | Sent On | Attachments |
|---|---|---|
| jerryji | 25 Dec 2007 11:53 | |
| Michael Bayer | 26 Dec 2007 06:55 | |
| jerryji | 26 Dec 2007 07:04 |
| Subject: | [sqlalchemy] Session().execute(...) with parameter syntax error exception![]() |
|---|---|
| From: | jerryji (jerr...@gmail.com) |
| Date: | 12/25/2007 11:53:59 AM |
| List: | com.googlegroups.sqlalchemy |
Dear Experts,
I'm using SQLAlchemy 0.4. The following hard-coded statement works fine --
result = model.Session.execute("select * from labels where labelid=10", {'labelid':10}, mapper=model.Label)
which returns something like --
mydb=# select * from labels where labelid=10 ; labelid | label_name | locale ---------+-------------+---------- 10 | electronics | en_US (1 row)
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 --
... File '/home/jerry/lib/python2.5/site-packages/SQLAlchemy-0.4.0- py2.5.egg/sqlalchemy/engine/base.py', line 869 in _cursor_execute raise exceptions.DBAPIError.instance(statement, parameters, e) ProgrammingError: (ProgrammingError) syntax error at or near ":" LINE 1: select * from labels as l where l.labelid=:labelid ^ 'select * from labels as l where l.labelid=:labelid' {'labelid': 10}
I don't believe I've caught a bug, but what else can it be/have I done wrong?
Many thanks in advance.
Jerry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




