SqlToSlackApiFileOperator

Use the SqlToSlackApiFileOperator to post query result as a file to Slack channel(s) through Slack API.

Using the Operator

This operator will execute a custom query in the provided SQL connection and publish a file to Slack channel(s).

An example usage of the SqlToSlackApiFileOperator is as follows:

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

SqlToSlackApiFileOperator(
    task_id="sql_to_slack_api_file",
    sql_conn_id=SQL_CONN_ID,
    sql="SELECT 6 as multiplier, 9 as multiplicand, 42 as answer",
    slack_channels="C123456",
    slack_conn_id="slack_api_default",
    slack_filename="awesome.json.gz",
    slack_initial_comment="Awesome compressed multiline JSON.",
    df_kwargs={"orient": "records", "lines": True},
)

Was this entry helpful?