airflow.providers.google.cloud.operators.spanner
¶
This module contains Google Spanner operators.
Module Contents¶
Classes¶
Creates a new Cloud Spanner instance, or if an instance with the same instance_id |
|
Deletes a Cloud Spanner instance. If an instance does not exist, |
|
Executes an arbitrary DML query (INSERT, UPDATE, DELETE). |
|
Creates a new Cloud Spanner database, or if database exists, |
|
Updates a Cloud Spanner database with the specified DDL statement. |
|
Deletes a Cloud Spanner database. |
- class airflow.providers.google.cloud.operators.spanner.SpannerDeployInstanceOperator(*, instance_id, configuration_name, node_count, display_name, project_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Creates a new Cloud Spanner instance, or if an instance with the same instance_id exists in the specified project, updates the Cloud Spanner instance.
See also
For more information on how to use this operator, take a look at the guide: SpannerDeployInstanceOperator
- Parameters
instance_id (str) -- Cloud Spanner instance ID.
configuration_name (str) -- The name of the Cloud Spanner instance configuration defining how the instance will be created. Required for instances that do not yet exist.
node_count (int) -- (Optional) The number of nodes allocated to the Cloud Spanner instance.
display_name (str) -- (Optional) The display name for the Cloud Spanner instance in the Google Cloud Console. (Must be between 4 and 30 characters.) If this value is not set in the constructor, the name is the same as the instance ID.
project_id (Optional[str]) -- Optional, the ID of the project which owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
- class airflow.providers.google.cloud.operators.spanner.SpannerDeleteInstanceOperator(*, instance_id, project_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Deletes a Cloud Spanner instance. If an instance does not exist, no action is taken and the operator succeeds.
See also
For more information on how to use this operator, take a look at the guide: SpannerDeleteInstanceOperator
- Parameters
instance_id (str) -- The Cloud Spanner instance ID.
project_id (Optional[str]) -- Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
- class airflow.providers.google.cloud.operators.spanner.SpannerQueryDatabaseInstanceOperator(*, instance_id, database_id, query, project_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Executes an arbitrary DML query (INSERT, UPDATE, DELETE).
See also
For more information on how to use this operator, take a look at the guide: SpannerQueryDatabaseInstanceOperator
- Parameters
instance_id (str) -- The Cloud Spanner instance ID.
database_id (str) -- The Cloud Spanner database ID.
query (Union[str, List[str]]) -- The query or list of queries to be executed. Can be a path to a SQL file.
project_id (Optional[str]) -- Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
- template_fields :Sequence[str] = ['project_id', 'instance_id', 'database_id', 'query', 'gcp_conn_id', 'impersonation_chain'][source]¶
- class airflow.providers.google.cloud.operators.spanner.SpannerDeployDatabaseInstanceOperator(*, instance_id, database_id, ddl_statements, project_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Creates a new Cloud Spanner database, or if database exists, the operator does nothing.
See also
For more information on how to use this operator, take a look at the guide: SpannerDeployDatabaseInstanceOperator
- Parameters
instance_id (str) -- The Cloud Spanner instance ID.
database_id (str) -- The Cloud Spanner database ID.
ddl_statements (List[str]) -- The string list containing DDL for the new database.
project_id (Optional[str]) -- Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
- class airflow.providers.google.cloud.operators.spanner.SpannerUpdateDatabaseInstanceOperator(*, instance_id, database_id, ddl_statements, project_id=None, operation_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Updates a Cloud Spanner database with the specified DDL statement.
See also
For more information on how to use this operator, take a look at the guide: SpannerUpdateDatabaseInstanceOperator
- Parameters
instance_id (str) -- The Cloud Spanner instance ID.
database_id (str) -- The Cloud Spanner database ID.
ddl_statements (List[str]) -- The string list containing DDL to apply to the database.
project_id (Optional[str]) -- Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
operation_id (Optional[str]) -- (Optional) Unique per database operation id that can be specified to implement idempotency check.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).
- class airflow.providers.google.cloud.operators.spanner.SpannerDeleteDatabaseInstanceOperator(*, instance_id, database_id, project_id=None, gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.models.BaseOperator
Deletes a Cloud Spanner database.
See also
For more information on how to use this operator, take a look at the guide: SpannerDeleteDatabaseInstanceOperator
- Parameters
instance_id (str) -- Cloud Spanner instance ID.
database_id (str) -- Cloud Spanner database ID.
project_id (Optional[str]) -- Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the Google Cloud connection is used.
gcp_conn_id (str) -- The connection ID used to connect to Google Cloud.
impersonation_chain (Optional[Union[str, Sequence[str]]]) -- 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. If set as a string, the account must grant the originating account the Service Account Token Creator IAM role. If set as a sequence, the identities from the list must grant Service Account Token Creator IAM role to the directly preceding identity, with first account from the list granting this role to the originating account (templated).