airflow.providers.microsoft.azure.hooks.synapse

Module Contents

Classes

AzureSynapseSparkBatchRunStatus

Azure Synapse Spark Job operation statuses.

AzureSynapseHook

A hook to interact with Azure Synapse.

Attributes

Credentials

airflow.providers.microsoft.azure.hooks.synapse.Credentials[source]
class airflow.providers.microsoft.azure.hooks.synapse.AzureSynapseSparkBatchRunStatus[source]

Azure Synapse Spark Job operation statuses.

NOT_STARTED = not_started[source]
STARTING = starting[source]
RUNNING = running[source]
IDLE = idle[source]
BUSY = busy[source]
SHUTTING_DOWN = shutting_down[source]
ERROR = error[source]
DEAD = dead[source]
KILLED = killed[source]
SUCCESS = success[source]
TERMINAL_STATUSES[source]
class airflow.providers.microsoft.azure.hooks.synapse.AzureSynapseHook(azure_synapse_conn_id=default_conn_name, spark_pool='')[source]

Bases: airflow.hooks.base.BaseHook

A hook to interact with Azure Synapse. :param azure_synapse_conn_id: The Azure Synapse connection id. :param spark_pool: The Apache Spark pool used to submit the job

conn_type :str = azure_synapse[source]
conn_name_attr :str = azure_synapse_conn_id[source]
default_conn_name :str = azure_synapse_default[source]
hook_name :str = Azure Synapse[source]
static get_connection_form_widgets()[source]

Returns connection widgets to add to connection form

static get_ui_field_behaviour()[source]

Returns custom field behaviour

get_conn()[source]

Returns connection for the hook.

run_spark_job(payload)[source]

Run a job in an Apache Spark pool. :param payload: Livy compatible payload which represents the spark job that a user wants to submit.

get_job_run_status()[source]

Get the job run status.

wait_for_job_run_status(job_id, expected_statuses, check_interval=60, timeout=60 * 60 * 24 * 7)[source]

Waits for a job run to match an expected status.

Parameters
  • job_id (int | None) – The job run identifier.

  • expected_statuses (str | set[str]) – The desired status(es) to check against a job run’s current status.

  • check_interval (int) – Time in seconds to check on a job run’s status.

  • timeout (int) – Time in seconds to wait for a job to reach a terminal status or the expected status.

cancel_job_run(job_id)[source]

Cancel the spark job run. :param job_id: The synapse spark job identifier.

Was this entry helpful?