SqlToSlackWebhookOperator

Use the SqlToSlackWebhookOperator to post query result as message to predefined Slack channel through Incoming Webhook.

Using the Operator

This operator will execute a custom query in the provided SQL connection and publish a Slack message that can be formatted and contain the resulting dataset (e.g. ASCII formatted dataframe).

An example usage of the SqlToSlackWebhookOperator is as follows:

tests/system/providers/slack/example_sql_to_slack_webhook.py[source]

SqlToSlackWebhookOperator(
    task_id="presto_to_slack",
    sql_conn_id=SQL_CONN_ID,
    sql=f"SELECT col FROM {SQL_TABLE}",
    slack_channel="my_channel",
    slack_webhook_conn_id="slack_default",
    slack_message="message: {{ ds }}, {{ results_df }}",
)

Was this entry helpful?