I'm not quite sure what is happening, but I could guess it's due to unicode
characters in the query text. I faced a somewhat similar issue before -
DRILL-987 <https://issues.apache.org/jira/browse/DRILL-987>

Just to give it a try, can you copy your query text into a text editor that
can display invisible characters (such as TextWrangler) or rewrite the
query to get rid of these?

Let us know if this resolves. Others can comment if they know better.

-Abhishek

On Tue, Jul 7, 2015 at 2:21 PM, Charles Givre <[email protected]> wrote:

> All,
> I'm trying to write some python code to interact with Drill and I'm getting
> a strange error.  I'm able to connect, and the SQL query is valid, but the
> query does not execute.  I tried the query via the web interface, and it
> worked...I've tried googling and not really gotten anywhere.  I'm running
> Drill 1.0.0.  Any help would be greatly appreciated.
> Thanks,
> -Charles
>
>
> import pyodbc
> import pandas as 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 position_title, COUNT( employee_id ) as
> employee_count
> FROM cp.`employee.json`
> GROUP BY position_title
> ORDER BY COUNT( employee_id ) DESC"""
>
> data = pd.read_sql( employee_query, conn )
>
>
> Error: ('HY000', '[HY000] [MapR][Drill] (1040) Drill failed to execute
> the query:
> ������������������������������\U000a0074�����������\U000a0060������������\n\n[30027]Query
> execution error. Details:[ \nPARSE ERROR: Lexical error at line 1,
> column 1.  Encoun (1040) (SQLExecDirectW)')
>
> During handling of the above exception, another exception occurred:
>
>
>
> DatabaseError: Execution failed on sql 'SELECT position_title, COUNT(
> employee_id ) as employee_count
> FROM cp.`employee.json`
> GROUP BY position_title
> ': ('HY000', '[HY000] [MapR][Drill] (1040) Drill failed to execute the
> query:
> ������������������������������\U000a0074�����������\U000a0060������������\n\n[30027]Query
> execution error. Details:[ \nPARSE ERROR: Lexical error at line 1,
> column 1.  Encoun (1040) (SQLExecDirectW)')
>

Reply via email to