You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TrinoHook uses wrong parameter representation when inserting rows #25937
TrinoHook.insert_rows() throws a syntax error due to the underlying prepared statement using "%s" as representation for parameters, instead of "?" which Trino uses.
What you think should happen instead
TrinoHook.insert_rows() should insert rows using Trino-compatible SQL statements.
The following exception is raised currently: trino.exceptions.TrinoUserError: TrinoUserError(type=USER_ERROR, name=SYNTAX_ERROR, message="line 1:88: mismatched input '%'. Expecting: ')', <expression>, <query>", query_id=xxx)
How to reproduce
Instantiate an airflow.providers.trino.hooks.trino.TrinoHook instance and use it's insert_rows() method.
Operators using this method internally are also broken: e.g. airflow.providers.trino.transfers.gcs_to_trino.GCSToTrinoOperator
Anything else
The issue seems to come from TrinoHook.insert_rows() relying on DbApiHook.insert_rows(), which uses "%s" to represent query parameters.
Currently working on a PR that will handle this the same way other hooks do (e.g SqliteHook): by overriding the DbApiHook._generate_insert_sql() function.
Activity
boring-cyborg commentedon Aug 24, 2022
Thanks for opening your first issue here! Be sure to follow the issue template!
alexandermalyga commentedon Aug 24, 2022
Currently working on a PR that will handle this the same way other hooks do (e.g SqliteHook): by overriding the
DbApiHook._generate_insert_sql()function.