I'm new to SQLAlchemy (and Python in general) and have been struggling
to get a basic execution wrapper working - the goal is to use of raw
batches of parameterized SQL - no ORM.

The engine initializes and I can run queries through it without a
problem, however the generated SQL from the execute statement seems to
interpret everything as string data.

The line:

engine.execute(text("select result = dateadd(day, :days, getdate())"),
dict(days = 7))

...yields the following error:

ProgrammingError: (ProgrammingError) ('42000', '[42000] [FreeTDS][SQL
Server]Argument data type varchar is invalid for argument 2 of dateadd
function. (8116) (SQLPrepare)') 'select result = dateadd(day, ?,
getdate())' [7]

Am I overlooking something simple here? Is there a way to have the
engine substitute parameters as per the Python datatype?

Thanks for any feedback!

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to