-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support run multiple sql statements from file in DBApiHook #16979
Comments
One comment - this should be definitely done on DBAPI hook, not in JdbcOperator. This way all DB operators will be able to use it. Assigning you to it :) |
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: airflow/airflow/providers/trino/hooks/trino.py Lines 111 to 112 in 6ab00bf
airflow/airflow/providers/snowflake/hooks/snowflake.py Lines 276 to 277 in 6ab00bf
After that we can execute the statements one by one. I think though there is a catch here. Executing |
So the idea here is to not break the statements (and execute one by one) inside |
Yeah. Sounds like the third time is the charm |
Hey @flolas - how is it going ? I saw a few people interested in it :) |
@potiuk Hi! I will work this week on the PR. |
Should be covered fully by #23971 |
Description
Support run multiple sql statements from file in
JdbcOperatorDBApiHook, when the provided file has multiple statements (we can check it with https://github.com/andialbrecht/sqlparse)Use case / motivation
Running single sql file with multiple sentences with JdbcOperator or any other DBApi operator (uses run method from DbApiHook, maybe we can implement here or in JdbcOperator):
Are you willing to submit a PR?
yes
The text was updated successfully, but these errors were encountered: