python - Apache Drill Returning Gibberish via ODBC? -
i'm trying write python script connects apache drill using pyodbc module. i'm able connect drill, when attempt query strange error looks character encoding. i've attached code below, , i'm using python 3.4. should add i've tried , without pandas , got same error, think error somewhere in odbc, have 0 experience odbc.
import pyodbc import pandas pd my_dsn = "driver=/opt/mapr/drillodbc/lib/universal/libmaprdrillodbc.dylib;host=localhost;port=31010;connectiontype=direct;catalog=drill;schema=mfs.views;authenticationtype=no authentication" conn = pyodbc.connect(my_dsn, autocommit=true) employee_query = "select * cp.`employee.json`" data = pd.read_sql( employee_query, conn ) here error:
error traceback (most recent call last) //anaconda/lib/python3.4/site-packages/pandas/io/sql.py in execute(self, *args, **kwargs) 1471 else: -> 1472 cur.execute(*args) 1473 return cur
error: ('hy000', '[hy000] [mapr][drill] (1040) drill failed execute query: ����������������\n[30027]query execution error. details:[ \nparse error: lexical error @ line 1, column 1. encountered: "\ufffd" (65533), after : ""\n\n\n[error id: 669ea9b9-34d6-4281-8898-57e8d0 (1040) (sqlexecdirectw)')
changing encoding utf-i6 in .mapr.drillodbc.ini fixed problem me:
[driver] drivermanagerencoding=utf-16
Comments
Post a Comment