apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.04k stars 14.28k forks source link

SqlToSlackApiFileOperator - Empty files #37191

Closed patricio-gonzalez-ventures closed 7 months ago

patricio-gonzalez-ventures commented 9 months ago

Apache Airflow Provider(s)

slack

Versions of Apache Airflow Providers

No response

Apache Airflow version

latest

Operating System

macos

Deployment

Official Apache Airflow Helm Chart

Deployment details

Astronomer

What happened

I am using the class SqlToSlackApiFileOperator which does not allow me to avoid sending messages to slack with an empty file.

What you think should happen instead

I would to add a new parameter to the class that will add the possibility to allow us to avoid sending empty files (len condition in https://github.com/apache/airflow/blob/main/airflow/providers/slack/transfers/sql_to_slack_webhook.py#L160).

How to reproduce

It can be easily reproduced after configuring a query that will retrieve no data.

Anything else

I can work in the PR (it'd be my first one), although I would need guidance if the approach is right.

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 9 months ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

Taragolis commented 9 months ago

Feel free to make a PR

(len condition in https://github.com/apache/airflow/blob/main/airflow/providers/slack/transfers/sql_to_slack_webhook.py#L160).

Small nit, you cant send file through Slack Incoming Webhook, this only available into the Slack API (APP). So you need to make changes into the different module

https://github.com/apache/airflow/blob/dec2662190dd4480d0c631da733e19d2ec9a479d/airflow/providers/slack/transfers/sql_to_slack.py#L136