Presto queries fail with semicolon added
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 545
- PR merge metrics
- No merged PRs in 30d
Description
Presto SQL commands typically require a semicolon in multiline queries to mark completion (and is also good practice for single-line queries):
```
SHOW
CATALOGS;
```
However, this does not currently work with PyHive:
```
from pyhive import presto
cursor = presto.connect('my-presto-instance').cursor()
cursor.execute('''SHOW
CATALOGS;
''')
print(cursor.fetchall())
```
Error:
```
DatabaseError: {'message': "line 2:24: mismatched input ';'. Expecting: 'LIKE', ", 'errorCode': 1, 'errorName': 'SYNTAX_ERROR', 'errorType': 'USER_ERROR', 'errorLocation': {'lineNumber': 2, 'columnNumber': 24}, 'failureInfo': {'type': 'io.prestosql.sql.parser.ParsingException', 'message': "line 2:24: mismatched input ';'.
```
The semicolon must be stripped from the query to work properly:
```
from pyhive import presto
cursor = presto.connect('my-presto-instance').cursor()
cursor.execute('''SHOW
CATALOGS
''')
print(cursor.fetchall())
```
This might be a lower-level problem than PyHive but I figured I would start here to see if there's any suggestions :)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.