Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

airflow.providers.google.cloud.sensors.cloud_sql

This module contains Google Cloud SQL sensors.

Exceptions

CloudSQLOperationError

Raised when the Cloud SQL operations check fails (for example, the instance is missing or access is denied).

Classes

CloudSQLNoOperationInProgressSensor

Wait until a Cloud SQL instance has no administrative operation in progress.

Module Contents

exception airflow.providers.google.cloud.sensors.cloud_sql.CloudSQLOperationError[source]

Bases: airflow.providers.common.compat.sdk.AirflowException

Raised when the Cloud SQL operations check fails (for example, the instance is missing or access is denied).

class airflow.providers.google.cloud.sensors.cloud_sql.CloudSQLNoOperationInProgressSensor(*, instance, project_id=PROVIDE_PROJECT_ID, gcp_conn_id='google_cloud_default', api_version='v1beta4', impersonation_chain=None, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), **kwargs)[source]

Bases: airflow.providers.common.compat.sdk.BaseSensorOperator

Wait until a Cloud SQL instance has no administrative operation in progress.

Cloud SQL serializes administrative operations per instance: only one import, export, backup or similar operation can run at a time. Submitting another while one is in flight fails with HTTP 409 operationInProgress. Place this sensor upstream of CloudSQLImportInstanceOperator / CloudSQLExportInstanceOperator (or between mutually exclusive admin operators) to serialize work against the same instance.

The sensor is operation-agnostic: it polls sqladmin.operations.list for the instance and succeeds once no operation is in a non-terminal (PENDING/RUNNING) state. It is best-effort – a new operation could still start between the sensor passing and the next operator submitting.

See also

For more information on how to use this sensor, take a look at the guide: CloudSQLNoOperationInProgressSensor

Parameters:
  • instance (str) – Name of the Cloud SQL instance to watch.

  • project_id (str) – Optional, Google Cloud Project ID. If not provided the default project is used.

  • gcp_conn_id (str) – The connection ID used to connect to Google Cloud.

  • api_version (str) – API version used (e.g. v1beta4).

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – Optional service account to impersonate using short-term credentials, or chained list of accounts required to get the access_token of the last account in the list, which will be impersonated in the request.

  • deferrable (bool) – Run the sensor in deferrable mode.

template_fields: collections.abc.Sequence[str] = ('project_id', 'instance', 'impersonation_chain')[source]
ui_color = '#D4ECEA'[source]
instance[source]
project_id = None[source]
gcp_conn_id = 'google_cloud_default'[source]
api_version = 'v1beta4'[source]
impersonation_chain = None[source]
deferrable[source]
poke(context)[source]

Override when deriving this class.

execute(context)[source]

Run on the worker and defer using the trigger when in deferrable mode.

execute_complete(context, event=None)[source]

Act as a callback for when the trigger fires.

Was this entry helpful?