Re: [sqlalchemy] how to compile statement from string and params dict?

2011-10-21 Thread Michael Bayer
it occurs upon execution. Ultimately the cursor.execute() method described here: http://www.python.org/dev/peps/pep-0249/ within SQLAlchemy, the general idea is here: http://www.sqlalchemy.org/docs/core/tutorial.html#using-text so, you'd add your params as second arguments to text(). But

Re: [sqlalchemy] how to compile statement from string and params dict?

2011-10-21 Thread Alex K
Maybe compiler from sqlalchemy can help me? from sqlalchemy.sql import compiler from sqlalchemy.sql.expression import text t = text(st) c = compiler.SQLCompiler(db.engine.dialect, t) and now I don't know how pass the params dict to compiler. Thanks. On Fri, Oct 21, 2011 at 6:40 PM, Michael

Re: [sqlalchemy] how to compile statement from string and params dict?

2011-10-21 Thread Michael Bayer
On Oct 21, 2011, at 10:30 AM, lestat wrote: > > If I do > result = st % params don't do that (where "that" is, using the "%" operator). Use bound parameters. Your DBAPI (I'm assuming psycopg2 here) will then format the value correctly. -- You received this message because you are subsc

[sqlalchemy] how to compile statement from string and params dict?

2011-10-21 Thread lestat
How I can compile statement with this 2 objects: st = """ SELECT "user".id AS user_id, "user".username AS user_username, "user".email AS user_email, "user".password AS user_password, "user".bd AS user_bd, "user".first_name AS user_first_name, "user".last_name AS user_last_name, "user".middle_name