airflow.providers.slack.transfers.sql_to_slack
¶
Module Contents¶
Classes¶
Executes an SQL statement in a given SQL connection and sends the results to Slack API as file. |
|
Executes an SQL statement in a given SQL connection and sends the results to Slack Incoming Webhook. |
- class airflow.providers.slack.transfers.sql_to_slack.SqlToSlackApiFileOperator(*, sql, sql_conn_id, sql_hook_params=None, parameters=None, slack_conn_id=SlackHook.default_conn_name, slack_filename, slack_channels=None, slack_initial_comment=None, slack_title=None, slack_base_url=None, slack_method_version='v2', df_kwargs=None, action_on_empty_df='send', **kwargs)[source]¶
Bases:
airflow.providers.slack.transfers.base_sql_to_slack.BaseSqlToSlackOperator
Executes an SQL statement in a given SQL connection and sends the results to Slack API as file.
See also
For more information on how to use this operator, take a look at the guide: SqlToSlackApiFileOperator
- Parameters
sql (str) – The SQL query to be executed
sql_conn_id (str) – reference to a specific DB-API Connection.
slack_conn_id (str) – Slack API Connection.
slack_filename (str) – Filename for display in slack. Should contain supported extension which referenced to
SUPPORTED_FILE_FORMATS
. It is also possible to set compression in extension:filename.csv.gzip
,filename.json.zip
, etc.sql_hook_params (dict | None) – Extra config params to be passed to the underlying hook. Should match the desired hook constructor params.
parameters (list | tuple | Mapping[str, Any] | None) – The parameters to pass to the SQL query.
slack_channels (str | Sequence[str] | None) – Comma-separated list of channel names or IDs where the file will be shared. If omitting this parameter, then file will send to workspace.
slack_initial_comment (str | None) – The message text introducing the file in specified
slack_channels
.slack_title (str | None) – Title of file.
slack_base_url (str | None) – A string representing the Slack API base URL. Optional
slack_method_version (typing_extensions.Literal[v1, v2]) – The version of the Slack SDK Client method to be used, either “v1” or “v2”.
df_kwargs (dict | None) – Keyword arguments forwarded to
pandas.DataFrame.to_{format}()
method.action_on_empty_df (typing_extensions.Literal[send, skip, error]) –
Specifying how to handle an empty sql output df. Possible values:
send
: (default) send the slack with an empty file.skip
: skip sending the slack message. Task state set to “skipped”.error
: raise an error to fail the task. Task state set to “failed”.
- class airflow.providers.slack.transfers.sql_to_slack.SqlToSlackOperator(*args, **kwargs)[source]¶
Bases:
airflow.providers.slack.transfers.sql_to_slack_webhook.SqlToSlackWebhookOperator
Executes an SQL statement in a given SQL connection and sends the results to Slack Incoming Webhook.
Deprecated, use
airflow.providers.slack.transfers.sql_to_slack_webhook.SqlToSlackWebhookOperator