On Jun 23, 2011, at 5:08 PM, Wells Oliver wrote:

> W/ psycopg2, you can do a cursor.execute(query, list) where list is an
> actual python list of values : [1,2,3]
> 
> W/ SQLAlchemy, it seems the session.execute(query, values) will only
> accept a dictionary for values. Am I missing something? Can I pass a
> list instead? Thanks.
> 

I was a little surprised the docs don't refer to the fact that you should use 
connection() for this case, so I updated them:

http://www.sqlalchemy.org/docs/orm/session.html#sqlalchemy.orm.session.Session.execute
http://www.sqlalchemy.org/docs/core/connections.html#sqlalchemy.engine.base.Connection.execute

"If a plain string is passed, it is first converted to a text() construct, 
which here means that bind parameters should be specified using the format 
:param. If raw DBAPI statement execution is desired, use Session.connection() 
to acquire a Connection, then call its execute() method."


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
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.

Reply via email to