unixODBC 错误 IM001
尝试执行任何简单查询时出现以下错误。我只是不明白发生了什么变化。
以下是 sqlalchemy (Elixir) 类的示例:
class Song(Entity):
using_options(tablename='tbSongs', autoload=True)
using_table_options(schema='apra')
数据库连接正常并且类构造正常,因为我可以执行 dir(Song) 并查看所有正确的列。然而,简单的查询是行不通的。
以下是对该类的查询和结果输出:
>>> songs = Song.query.all()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1729, in all
return list(self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1839, in __iter__
return self._execute_and_instances(context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1854, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1399, in execute
params)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1532, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1633, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 325, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.DBAPIError: (Error) ('IM001', '[IM001] [unixODBC][Driver Manager]Driver does not support this function (0) (SQLColAttribute)') 'SELECT [tbSongs_1].[ID_Song] AS [apra_tbSongs_ID_Song], [tbSongs_1].[Album] AS [apra_tbSongs_Album], [tbSongs_1].[Title] AS [apra_tbSongs_Title], [tbSongs_1].[Composer] AS [apra_tbSongs_Composer], [tbSongs_1].[Performer] AS [apra_tbSongs_Performer], [tbSongs_1].[TrackNumber] AS [apra_tbSongs_TrackNumber], [tbSongs_1].[Duration] AS [apra_tbSongs_Duration], [tbSongs_1].[RecordLabel] AS [apra_tbSongs_RecordLabel], [tbSongs_1].[Notes] AS [apra_tbSongs_Notes], [tbSongs_1].[Class] AS [apra_tbSongs_Class], [tbSongs_1].[SongID] AS [apra_tbSongs_SongID], [tbSongs_1].[Deleted] AS [apra_tbSongs_Deleted] \nFROM apra.[tbSongs] AS [tbSongs_1]' ()
>>>
设置详细信息:
- 32bit Arch Linux
- Python 2.7.2
- sqlalchemy 0.7.2
- elixir 0.7.1
- FreeTDS 0.82-5
- unixodbc 2.3.0-1
/etc/odbcinst.ini:
[ODBC Drivers]
tds = Installed
[tds]
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsodbc.so
/etc/ odbc.ini:
[ODBC]
Trace = 0
[DBNAME]
Driver = TDS
Trace = No
Server = xx.xx.xx.xx\dbname
Database = dbname
Port = 1433
I get the following error when trying to do any simple query. I just can't figure out what's changed.
Here is an example of the sqlalchemy (Elixir) class:
class Song(Entity):
using_options(tablename='tbSongs', autoload=True)
using_table_options(schema='apra')
The database connection is ok and the classes construct ok because I can do dir(Song)
and see all the correct columns. However, a simple query won't work.
Here is a query on that class and the resulting output:
>>> songs = Song.query.all()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1729, in all
return list(self)
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1839, in __iter__
return self._execute_and_instances(context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 1854, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1399, in execute
params)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1532, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1633, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 325, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.DBAPIError: (Error) ('IM001', '[IM001] [unixODBC][Driver Manager]Driver does not support this function (0) (SQLColAttribute)') 'SELECT [tbSongs_1].[ID_Song] AS [apra_tbSongs_ID_Song], [tbSongs_1].[Album] AS [apra_tbSongs_Album], [tbSongs_1].[Title] AS [apra_tbSongs_Title], [tbSongs_1].[Composer] AS [apra_tbSongs_Composer], [tbSongs_1].[Performer] AS [apra_tbSongs_Performer], [tbSongs_1].[TrackNumber] AS [apra_tbSongs_TrackNumber], [tbSongs_1].[Duration] AS [apra_tbSongs_Duration], [tbSongs_1].[RecordLabel] AS [apra_tbSongs_RecordLabel], [tbSongs_1].[Notes] AS [apra_tbSongs_Notes], [tbSongs_1].[Class] AS [apra_tbSongs_Class], [tbSongs_1].[SongID] AS [apra_tbSongs_SongID], [tbSongs_1].[Deleted] AS [apra_tbSongs_Deleted] \nFROM apra.[tbSongs] AS [tbSongs_1]' ()
>>>
Setup details:
- 32bit Arch Linux
- Python 2.7.2
- sqlalchemy 0.7.2
- elixir 0.7.1
- FreeTDS 0.82-5
- unixodbc 2.3.0-1
/etc/odbcinst.ini:
[ODBC Drivers]
tds = Installed
[tds]
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsodbc.so
/etc/odbc.ini:
[ODBC]
Trace = 0
[DBNAME]
Driver = TDS
Trace = No
Server = xx.xx.xx.xx\dbname
Database = dbname
Port = 1433
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也有这个错误,降级到 unixODBC 2.2.12 为我解决了这个问题(注意我无法让 PyOBDC 使用 2.2.14 构建,必须是 2.2.12)。我对 unix 的 ODBC 工具的新版本的状态感到相当困扰(Freetds 0.91 也有很大问题)。
I have this error as well and downgrading to unixODBC 2.2.12 fixes it for me (note I can't get PyOBDC to build with 2.2.14, has to be 2.2.12). I'm fairly troubled by the state of the newer releases of ODBC tools for unix (Freetds 0.91 is very problematic as well).
尝试删除预打包的 FreeTDS、unixODBC 和 pyodbc。分别使用版本 0.91、2.3.0 和 2.1.9 从源进行重建对我来说很有效,但这可能是一个棘手的过程。我在 SQLAlchemy 小组最近的一个帖子中详细介绍了它,网址为 http:// groups.google.com/group/sqlalchemy/browse_thread/thread/971e068032d51dd5
Try removing prepackaged FreeTDS, unixODBC and pyodbc. Rebuilding from sources using version 0.91, 2.3.0 and 2.1.9 respectively has worked for me but it can be a tricky process. I have covered it in some detail on a recent thread on SQLAlchemy group at http://groups.google.com/group/sqlalchemy/browse_thread/thread/971e068032d51dd5
您能否提供发生这种情况的 ODBC 跟踪?我刚刚意识到这个问题,而且我(目前)无法重现它。因此,如果您可以将其发生的日志发送给我,那么这应该是朝着正确方向迈出的一步。
Can you provide a ODBC trace of this occuring. I have only just become aware of this problem and I can't (at the moment) reproduce it. So if you can send me the log of it happing it should be a step in the right direction.