-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
Operator SQLExecuteQueryOperator
not logging RAISE NOTICE
statements in PostgreSQL functions
#40116
Comments
RAISE NOTICE
statements in PostgreSQL functionsSQLExecuteQueryOperator
not logging RAISE NOTICE
statements in PostgreSQL functions
If someone would like to investigate it, I marked it as good first issue. |
BTW. It would be great for somoeone who might want to look at it, if you posted example of the functions and how you are calling them @hpereira98 - otherwise it might be difficult for them to investigate it. The more information and reproduciblitly you provide, the more likely someone will be interested in fixing it. |
Added example function and DAG! |
For anyone who would like to implement it (maybe you @hpereira98 ? This is the most certain way to get it done, otherwise it will have to wait for someone who will volunteer to implement it): it seems that in order to implement it one would have to print notices from the connection https://stackoverflow.com/questions/50274199/python2-print-postgresql-stored-procedure-raise-notice . |
The weird thing is that they were being printed in the version we were using previously ( |
Well Airflow 1.10 is end of life for more than 3 years - this is when all users were supposed to migrate and nobody remembers anything that was there (there were probablly 10.000 or so changes and no backwards compatibility even expected for 1.10. If you had migrated back then probably you would find someone who would know somothing, but being 3 years late with the migration does not help. You can take a look at release notes since then or code changes (probably few thousands of entries) and see if you can find somethign because what's written in the release notes is the best trace of what had happend between the 3 years untouched version and now. At this stage this is a feature to be implemented, not even a bug, and even if it were classified as a bug it falls into "hopefully someone will pick an interest and implement it" - this is a free open-source software and comes "as is" and generally a lot of people contribute what they need if it is missing. If you are in a hurry and do not want to wait for someone to show up - the most certain way to get something like that is to roll sleeves up and do it (or find someone who is more able if you don't feel like doing it yourself). |
In 1.10.12 the postgres operator logged all notices after running the sql command. I think this happens here. In newer provider versions this changed. I can have a look at it and see if and how we could enable or at least optional enable it. |
PRs to add it back are always most welcome |
Sure. Please assign it to me. Happy to help here. |
Cool :) |
Apache Airflow Provider(s)
postgres
Versions of Apache Airflow Providers
apache-airflow-providers-postgres==5.7.1
Apache Airflow version
2.9.1
Operating System
Linux
Deployment
Other 3rd-party Helm chart
Deployment details
Airflow deployed in remote K8s cluster and locally using a Minikube cluster.
PostgreSQL version: 10.15.
What happened
We've upgraded our Airflow instance from 1.10.12 to 2.9.1.
We were previously using
PostgresOperator
to trigger the execution of a few PostgreSQL functions, which hadRAISE NOTICE
statements to print some important information regarding the functions execution.In the previous version we were using, we could see those logs in the Web UI,
However, after the upgrade, we stopped seeing these.
We've tried:
client_min_messages
andlog_min_messages
toNOTICE
in the database level;PostgresOperator
to the newSQLExecuteQueryOperator
;show_return_value_in_logs
to true.None of these seem to allow these logs being shown.
What you think should happen instead
RAISE NOTICE
statements should be shown in the DAGs logs.How to reproduce
RAISE NOTICE
statement.Database preparation statements:
Example function:
Example DAG:
Anything else
This was also reported by another Airflow user in https://stackoverflow.com/questions/77913339/how-do-i-print-raise-notice-from-postgresql-in-airflow-logs.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: