Skip to content

Error while trying to read a tabela #3

@guibayer

Description

@guibayer

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions