Error message:

sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', 
"[42000] [FreeTDS][SQL Server]Incorrect syntax near 
'dbo.APPLICATION_STATUS_DIM.'.\n (102) (SQLExecDirectW)") [SQL: 'SELECT 
dbo."APPLICATION_STATUS_DIM"."APPLICATION_STATUS_SKEY" AS 
"dbo_APPLICATION_STATUS_DIM_APPLICATION_STATUS_SKEY", 
dbo."APPLICATION_STATUS_DIM"."APPLICATION_STATUS_CD" AS 
"dbo_APPLICATION_STATUS_DIM_APPLICATION_STATUS_CD", 
dbo."APPLICATION_STATUS_DIM"."APPLICATION_STATUS_DESC" AS 
"dbo_APPLICATION_STATUS_DIM_APPLICATION_STATUS_DESC" \nFROM 
dbo."APPLICATION_STATUS_DIM"'] (Background on this error at: 
http://sqlalche.me/e/f405)

Code triggering the error:

for record in source.query(table).all():

pip freeze output:

pkg-resources==0.0.0
psycopg2==2.7.6.1
pyodbc==4.0.24
SQLAlchemy==1.2.14

Purpose of the code:

Trying a quick stab at migrating a db from sybase ase to either postgres or 
sql server. Evaluating both targets. Connection works fine, pulling table 
metadata works fine, writing to target db structure from meta works fine, 
but selecting the records leads to that.

If I take that statement as is and paste into dbeaver (replacing the \n 
with an actual carriage return) everything works.

This fails on both linux (using FreeTDS version set to 5) and windows 
(using the dsn name for the actual ASE driver setup in my odbc)

I am confused what is going on here that causes sybase to see this as a 
syntax error.

Ken

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to