OpenInformix / InformixAlchemy

Informix SQLAlchemy adapter
Apache License 2.0
6 stars 4 forks source link

Error while trying to read a tabela #3

Open guibayer opened 2 years ago

guibayer commented 2 years ago

Hello,

I'm trying to read a table using SqlAlchemy on the Table() function but i got this error:

DBAPIError: (IfxPyDbi.Error) IfxPyDbi::Error: Exception('[Informix][Informix ODBC Driver][Informix]A syntax error has occurred. SQLCODE=-201') [SQL: SELECT "SYSCAT"."COLUMNS"."COLNAME", "SYSCAT"."COLUMNS"."TYPENAME", "SYSCAT"."COLUMNS"."DEFAULT", "SYSCAT"."COLUMNS"."NULLS", "SYSCAT"."COLUMNS"."LENGTH", "SYSCAT"."COLUMNS"."SCALE", "SYSCAT"."COLUMNS"."IDENTITY", "SYSCAT"."COLUMNS"."GENERATED" FROM "SYSCAT"."COLUMNS" WHERE "SYSCAT"."COLUMNS"."TABSCHEMA" = ? AND "SYSCAT"."COLUMNS"."TABNAME" = ? ORDER BY "SYSCAT"."COLUMNS"."COLNO"] [parameters: (b'DUMMY', b'DIEMP')] (Background on this error at: http://sqlalche.me/e/14/dbapi)

MyCode:

import sqlalchemy as db

import IfxPyDbi as dbapi2

db.dialects.registry.register("informix", "IfxAlchemy.IfxPy", "IfxDialect_IfxPy") db.dialects.registry.register("informix.IfxPy", "IfxAlchemy.IfxPy", "IfxDialect_IfxPy") db.dialects.registry.register("informix.pyodbc", "IfxAlchemy.pyodbc", "IfxDialect_pyodbc")

ConStr = 'informix://myconnstring'

engine = db.create_engine(ConStr) connection = engine.connect()

metadata = db.MetaData()

diaemp = db.Table('diemp', metadata, autoload=True, autoload_with=engine)

Someone faced the same problem or got this function Table() working?

snpulido commented 9 months ago

Hi, I'm facing the same issue. Have you found a solution, @guibayer?