Python 连接到 Hive
Python Connection to Hive
我安装了 Hortonworks Hive ODBC 驱动程序并在数据源中创建了一个连接。我测试了它,它成功地工作了。
我安装了PyODBC,写了下面的代码
import os, sys, pyodbc;
con = pyodbc.connect("DSN=MyCon")
我收到错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
我也试过了
import pyodbc, sys, os
pyodbc.pooling = False
pyodbc.autocommit = False
con = pyodbc.connect("DSN=MyCon")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
也试过
con = pyodbc.connect("DSN=Tenet", autocommit=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
我解决了.....我不会删除我的问题并将答案放在这里
pyodbc.autocommit = True
con = pyodbc.connect("DSN=MyCon", autocommit=True)
这是根据这篇文章的建议完成的
https://code.google.com/p/pyodbc/issues/detail?id=162
** 感谢下面 Kyle Porter 的建议...现在完全有道理 **
我安装了 Hortonworks Hive ODBC 驱动程序并在数据源中创建了一个连接。我测试了它,它成功地工作了。
我安装了PyODBC,写了下面的代码
import os, sys, pyodbc;
con = pyodbc.connect("DSN=MyCon")
我收到错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
我也试过了
import pyodbc, sys, os
pyodbc.pooling = False
pyodbc.autocommit = False
con = pyodbc.connect("DSN=MyCon")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
也试过
con = pyodbc.connect("DSN=Tenet", autocommit=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pyodbc.Error: ('HYC00', '[HYC00] [Hortonworks][ODBC] (11470) Transactions are not supported. (11470) (SQLSetConnnectAttr(SQL_ATTR_AUTOCOMMIT))')
我解决了.....我不会删除我的问题并将答案放在这里
pyodbc.autocommit = True
con = pyodbc.connect("DSN=MyCon", autocommit=True)
这是根据这篇文章的建议完成的
https://code.google.com/p/pyodbc/issues/detail?id=162
** 感谢下面 Kyle Porter 的建议...现在完全有道理 **