Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

1.3.1 seems to hide syntax errors #54

Closed
abridgett opened this issue Feb 14, 2018 · 6 comments
Closed

1.3.1 seems to hide syntax errors #54

abridgett opened this issue Feb 14, 2018 · 6 comments

Comments

@abridgett
Copy link

Running a (broken) query on v1.1.1:

ERROR    Failed to execute query.
Traceback (most recent call last):
  File ".../pyathenajdbc/cursor.py", line 117, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
ERROR    line 89:22: mismatched input 'IN' expecting {')', 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'OR', 'AND', 'UNION', 'EXCEPT', 'INTERSECT'} (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: 14660a88-118e-11e8-b0e3-6d7bda9bea82)

However with v1.3.1 those really handy details seem lost:

ERROR    Failed to execute query.
Traceback (most recent call last):
  File ".../pyathenajdbc/cursor.py", line 172, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
ERROR    java.sql.SQLException: Failed to run query

I think this is the change that changed this:
c253586

I've tried to workaround this by putting that logic in my code but it looks like the data is lost (presumably as the exception is reraised)

@laughingman7743
Copy link
Owner

I think that the difference in error message may be due to the difference in version of JDBC driver.
The correspondence of JDBC driver version is as follows.

version JDBC driver version
v1.1.1 AthenaJDBC41-1.0.1
v1.3.1 AthenaJDBC41-1.1.0

Please let me know the table definition and the query where the error occurred.

Thanks,

@abridgett
Copy link
Author

Gosh - that was fast! It looks like not the JDBC driver change:

I'm running this SQL:

select count(*) from speed_augmented_v2 where dt='2018-01-01' and client_code in %(app_list)s

Our wrapper didn't support lists (now fixed) so app_list was a string rather than list object which caused the SQL error.

On PyAthenaJDBC v1.1.1 (AthenaJDBC v1.0.1):

2018-02-15 14:21:53,640 ERROR    Failed to execute query.
Traceback (most recent call last):
  File "/Users/adrian/projects/os/data-athena/venv/lib/python3.6/site-packages/pyathenajdbc/cursor.py", line 117, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
2018-02-15 14:21:53,646 ERROR    line 1:79: mismatched input 'in' expecting {<EOF>, 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'OR', 'AND', 'UNION', 'EXCEPT', 'INTERSECT'} (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: 91ff6d70-125b-11e8-a10f-e52a7edfa5db)

On PyAthenaJDBC v1.3.1 (AthenaJDBC v1.1.0):

2018-02-15 14:22:52,618 ERROR    Failed to execute query.
Traceback (most recent call last):
  File "/Users/adrian/projects/os/data-athena/venv/lib/python3.6/site-packages/pyathenajdbc/cursor.py", line 172, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
2018-02-15 14:22:52,706 ERROR    java.sql.SQLException: Failed to run query

Now trying with the alternative JDBC drivers:

On PyAthenaJDBC v1.1.1 (AthenaJDBC v1.1.0):

2018-02-15 14:26:23,327 ERROR    Failed to execute query.
Traceback (most recent call last):
  File "/Users/adrian/projects/os/data-athena/venv/lib/python3.6/site-packages/pyathenajdbc/cursor.py", line 117, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
2018-02-15 14:26:23,333 ERROR    line 1:79: mismatched input 'in' expecting {<EOF>, 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'OR', 'AND', 'UNION', 'EXCEPT', 'INTERSECT'} (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: 32b8e811-125c-11e8-a9cb-57f70b9cca77)

On PyAthenaJDBC v1.3.1 (AthenaJDBC v1.0.1):

2018-02-15 14:24:31,141 ERROR    Failed to execute query.
Traceback (most recent call last):
  File "/Users/adrian/projects/os/data-athena/venv/lib/python3.6/site-packages/pyathenajdbc/cursor.py", line 172, in execute
    result_set = self._statement.executeQuery(query)
jpype._jexception.java.sql.SQLExceptionPyRaisable: java.sql.SQLException: Failed to run query
2018-02-15 14:24:31,237 ERROR    java.sql.SQLException: Failed to run query

@laughingman7743
Copy link
Owner

Thank you for the quick reply.
I understand that it is not a difference in JDBC driver version.
Please also let me know the version of Python you are running.

I think that the implementation before change is somewhat dirty. I will think about the smart implementation by hand over the error information on the weekend.
Please tell me if you know something good implementation method :)

@laughingman7743
Copy link
Owner

  File "/Users/adrian/projects/os/data-athena/venv/lib/python3.6/site-packages/pyathenajdbc/cursor.py", line 172, in execute

The execution environment is Python 3.6.

@laughingman7743
Copy link
Owner

Sorry for the late reply.
I fixed this issue with the following pull request. Please check it.
#55

Well, it has not changed much from the previous implementation 😂
Thanks,

@abridgett
Copy link
Author

super - that works well here - saves a load of time figuring out what's wrong :-)

laughingman7743 added a commit that referenced this issue Mar 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants