-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
SQLExecuteQueryOperator AttributeError exception when returning result to XCom #31080
Comments
Interesting one. Proposed a fix in #31136 @Stormhand |
The change adds conditional processing of output based on criteria that can be overridden by the operator extending the common.sql BaseSQLOperator. Originally, output processing has only been happening if "do_xcom_push" was enabled, but in some cases we want to run processing also when do_xcom_push is disabled (for example in case of databricks SQL operator, it might be done when the output is redirected to a file). This change enables it. Fixes: apache#31080
The change adds conditional processing of output based on criteria that can be overridden by the operator extending the common.sql BaseSQLOperator. Originally, output processing has only been happening if "do_xcom_push" was enabled, but in some cases we want to run processing also when do_xcom_push is disabled (for example in case of databricks SQL operator, it might be done when the output is redirected to a file). This change enables it. Fixes: #31080
Hi @potiuk , unfortunately it happened again. This time i need do_xcom_push:
This is how i use it:
Databricks providers, i use the latest:
Airflow is 2.6.1/python 3.10 UPDATE:
|
Can you please open a new issue please @Stormhand - this is quite bit different issue with similar stacktrace (cc: @alexott - maybe you can take a look and implement a fix for that one. |
Thank you. Opened a new one #31753 |
Apache Airflow version
2.6.0
What happened
I am using DatabricksSqlOperator which writes the result to a file. When the task finishes it writes all the data correctly to the file the throws the following exception:
I found that SQLExecuteQueryOperator always return the result(so pushing XCom) from its execute() method except when the parameter do_xcom_push is set to False. But if do_xcom_push is False then the method _process_output() is not executed and DatabricksSqlOperator wont write the results to a file.
What you think should happen instead
I am not sure if the problem should be fixed in DatabricksSqlOperator or in SQLExecuteQueryOperator. In any case setting do_xcom_push shouldn't automatically prevent the exevution of _process_output():
What happens now is - i have in the same time big result in a file AND in the XCom.
How to reproduce
I suspect that the actual Exception is related to writing the XCom to the meta database and it might not fail on other scenarios.
Operating System
Debian GNU/Linux 11 (bullseye) docker image
Versions of Apache Airflow Providers
apache-airflow-providers-amazon==8.0.0
apache-airflow-providers-apache-spark==4.0.1
apache-airflow-providers-celery==3.1.0
apache-airflow-providers-cncf-kubernetes==6.1.0
apache-airflow-providers-common-sql==1.4.0
apache-airflow-providers-databricks==4.1.0
apache-airflow-providers-docker==3.6.0
apache-airflow-providers-elasticsearch==4.4.0
apache-airflow-providers-ftp==3.3.1
apache-airflow-providers-google==10.0.0
apache-airflow-providers-grpc==3.1.0
apache-airflow-providers-hashicorp==3.3.1
apache-airflow-providers-http==4.3.0
apache-airflow-providers-imap==3.1.1
apache-airflow-providers-microsoft-azure==6.0.0
apache-airflow-providers-microsoft-mssql==3.3.2
apache-airflow-providers-mysql==5.0.0
apache-airflow-providers-odbc==3.2.1
apache-airflow-providers-oracle==3.6.0
apache-airflow-providers-postgres==5.4.0
apache-airflow-providers-redis==3.1.0
apache-airflow-providers-samba==4.1.0
apache-airflow-providers-sendgrid==3.1.0
apache-airflow-providers-sftp==4.2.4
apache-airflow-providers-slack==7.2.0
apache-airflow-providers-snowflake==4.0.5
apache-airflow-providers-sqlite==3.3.2
apache-airflow-providers-ssh==3.6.0
apache-airflow-providers-telegram==4.0.0
Deployment
Docker-Compose
Deployment details
Using extended Airflow image, LocalExecutor, Postgres 13 meta db as container in the same stack.
docker-compose version 1.29.2, build 5becea4c
Docker version 23.0.5, build bc4487a
Anything else
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: