Hi!
I encountered an issue with the impala-sqlalchemy connector when querying a table with a name that contains a reserved word.
The table is named "reserved.name" and usually can be queried using backticks like so:
SELECT `reserved`.name.column_1, `reserved`.name.column_2 FROM `reserved`.name;
To load the table into sqlalchemy I then use
def impala_conn():
return connect(
host='localhost'
)
engine = create_engine('impala://', creator=impala_conn, echo=True)
metadata = MetaData(engine)
table = Table(`reserved`.name, metadata, autoload=True)
table contains a correct description of the table.
However when trying to query the table with
stmt = select(table).limit(100)
engine.execute(stmt)
the query escapes the already escaped table name again, leading to a query that fails:
SELECT ``reserved`.name`.column_1, ...
^
Encountered: EMPTY IDENTIFIER
Expected: ALL, CASE, CAST, DEFAULT, DISTINCT, EXISTS, FALSE, IF, INTERVAL, LEFT, NOT, NULL, REPLACE, RIGHT, STRAIGHT_JOIN, TRUNCATE, TRUE, IDENTIFIER
CAUSED BY: Exception: Syntax error
Is there a way to avoid the additional escaping during the query?
Hi!
I encountered an issue with the impala-sqlalchemy connector when querying a table with a name that contains a reserved word.
The table is named "reserved.name" and usually can be queried using backticks like so:
To load the table into sqlalchemy I then use
tablecontains a correct description of the table.However when trying to query the table with
the query escapes the already escaped table name again, leading to a query that fails:
Is there a way to avoid the additional escaping during the query?