first of all, sorry if I'm not writing in the right place or I'm not providing enough info about the issue.
Using SQL Alchemy, with pyodbc. I'm trying to reflect a table. When I try to do that, i get this message
DBAPIError: (pyodbc.Error) ('IM001', '[IM001] [unixODBC][Driver Manager]Driver does not support this function (0) (SQLNumParams)') [SQL: u'SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TABLE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1].[NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLUMN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] \nFROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] \nWHERE [COLUMNS_1].[TABLE_NAME] = CAST(? AS NVARCHAR(max)) AND [COLUMNS_1].[TABLE_SCHEMA] = CAST(? AS NVARCHAR(max)) ORDER BY [COLUMNS_1].[ORDINAL_POSITION]'] [parameters: ('Order', 'dbo')]
Here is the code..
>>> from sqlalchemy.orm.session import Session
>>> from sqlalchemy.schema import MetaData
>>> import sqlalchemy as SQLA
>>> eng = SQLA.create_engine(connection_string)
>>> session = Session(eng.connect())
>>> class DB:
... pass
...
>>> db = DB()
>>> db.session = session
>>> db.engine = eng
>>> db.metadata = MetaData(bind=db.engine, schema='dbo')
>>> db.session.execute("select * from information_schema.columns")
<sqlalchemy.engine.result.ResultProxy object at 0x7f76eb770890>
>>> t = SQLA.Table('Order', db.metadata, autoload=True, extend_existing=True, autoload_with=db.engine)
>>> Traceback (most recent call last):
... File "<stdin>", line 1, in <module> ... See the error above
The code is running on a RHEL 7.x with unixODBC, Microsoft SQL Server Native clinet 11 for Linux. Python 2.7.11
Here are the pip requirements
- click (6.6) db-connection-maker (1.2.0)
- Flask (0.11.1)
- itsdangerous (0.24)
- Jinja2 (2.8)
- MarkupSafe (0.23)
- pip (8.0.2)
- pyaml (15.8.2)
- pyodbc (3.0.10)
- PyYAML (3.11)
- setuptools (19.6.2)
- simplejson (3.8.2)
- SQLAlchemy (1.0.14)
- Werkzeug (0.11.10)
Note that the same code works without issues on windows.