Reflecting SQLAlchemy MetaData Object from Sybase IQ Database

34 Views Asked by At

I am trying to perform metadata reflection in SQLAlchemy using a Sybase IQ database. I'm connecting to the database using sqlalchemy-sybase, a third-party SQLAlchemy dialect based on the Sybase dialect which was included in SQLAlchemy 1.3 but has since been removed. Here is the code I am running:

from sqlalchemy import create_engine, MetaData, Table




engine = create_engine(CONNECTION_URI)
metadata_obj = MetaData()
metadata_obj.reflect(bind=engine, schema="dbo")

But the code returns the following error:

ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [SAP][ODBC Driver][SAP IQ]Syntax error near 'precision' on line 6 (-131) (SQLPrepare)")

[SQL:
SELECT col.name AS name,
       t.name AS type,
       (col.status & 8) AS nullable, 
       (col.status & 128) AS autoincrement,
       com.text AS 'default',
       col.prec AS precision,
       col.scale AS scale,
       col.length AS length
FROM systypes 
t, syscolumns ]col LEFT OUTER JOIN syscomments com ON 
    col.cdefault = com.id
WHERE col.usertype = t.usertype
    AND col.id = ?
ORDER BY col.colid
]
[parameters: (3719922,)]

I tried the above following instructions--specifically, I followed what is under the "Reflecting All Tables at Once" heading.

0

There are 0 best solutions below