eladkal commented on issue #16979: URL: https://github.com/apache/airflow/issues/16979#issuecomment-879810198
> I am already using the PostgresOperator and MySqlHook to execute SQL queries that contain multiple queries seperated by semicolons. And both the operator and the hook use DbApiHook for doing so. Am I missing something here? Thank you for any clarification. Assuming you have a SQL script: `Select 1; Select 2;` Both Postgres and MySQL are able to execute this script. However you will not be able to execute this script in Snowflake, Presto nor Trino. This is why for these databases we first parse the script and break the statements one by one: https://github.com/apache/airflow/blob/6ab00bfcfdfe1213928281527f32ca31b77cce1b/airflow/providers/trino/hooks/trino.py#L111-L112 https://github.com/apache/airflow/blob/6ab00bfcfdfe1213928281527f32ca31b77cce1b/airflow/providers/snowflake/hooks/snowflake.py#L276-L277 After that we can execute the statements one by one. I think though there is a catch here. Executing `Update table a ... ; Update table b...;` may not the same as executing `Update table a ... ;` and then executing `Update table b...;` when we break the statements there is a question of when the `commit(s)` gets executed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
