Reputation: 697
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
Note that the same code works without issues on windows.
Upvotes: 0
Views: 377
Reputation: 697
I do a try with pymmsql and it works without issues. The problem was on pyodbc, maybe it still have some problems with ms sql odbc drivers on Linux.
Upvotes: 0