【发布时间】:2018-09-14 16:59:41
【问题描述】:
我正在尝试让 Pyodbc 与 Google BigQuery 一起使用。 我安装的 ODBC 管理器是 unixodbc (ubuntu) Simba 驱动程序的配置应该没问题,因为 SQL 命令有效,我可以从那里执行查询。
但是,当我使用 Pyodbc 时,我卡住了。 这是代码:
import pyodbc
dbname = 'testdb'
driver_str = '{Simba ODBC Driver for Google BigQuery 64-bit}'
cnxn = pyodbc.connect(driver=driver_str, database=dbname)
c = conn.cursor()
c.execute('SELECT * FROM tablename')
print(c.fetchone())
它会产生以下错误:
Traceback (most recent call last):
File "/home/virus/work/lutech/wind/usecase3/test_odbc.py", line 48, in <module>
cnxn = pyodbc.connect(driver=driver_str, database=dbname)
pyodbc.OperationalError: ('08001', '[08001] [unixODBC][Simba][DSI] An error occurred while attempting to retrieve the error message for key \'UnableToEstConn\' and component ID 1: Could not open error message files - Check that "/home/virus/work/lutech/wind/simba/googlebigqueryodbc/lib/64/$(INSTALLDIR)/ErrorMessages/en-US/ODBCMessages.xml" or "/home/virus/work/lutech/wind/simba/googlebigqueryodbc/lib/64/$(INSTALLDIR)/ErrorMessages/ODBCMessages_en-US.xml" exists and are accessible. MessageParameters=["{[Catalog] [OAuthMechanism]}"] (-1) (SQLDriverConnect)')
我不明白这是什么意思,但它指的是 Simba Error 文件夹中的一个文件。
有什么帮助吗?
【问题讨论】:
标签: google-bigquery odbc pyodbc unixodbc