:mod:`airflow.contrib.operators.gcp_spanner_operator` ===================================================== .. py:module:: airflow.contrib.operators.gcp_spanner_operator Module Contents --------------- .. py:class:: CloudSpannerInstanceDeployOperator(instance_id, configuration_name, node_count, display_name, project_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`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. :param instance_id: Cloud Spanner instance ID. :type instance_id: str :param configuration_name: The name of the Cloud Spanner instance configuration defining how the instance will be created. Required for instances that do not yet exist. :type configuration_name: str :param node_count: (Optional) The number of nodes allocated to the Cloud Spanner instance. :type node_count: int :param display_name: (Optional) The display name for the Cloud Spanner instance in the GCP 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. :type display_name: str :param project_id: Optional, the ID of the project which owns the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'configuration_name', 'display_name', 'gcp_conn_id'] .. method:: _validate_inputs(self) .. method:: execute(self, context) .. py:class:: CloudSpannerInstanceDeleteOperator(instance_id, project_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`airflow.models.BaseOperator` Deletes a Cloud Spanner instance. If an instance does not exist, no action is taken and the operator succeeds. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudSpannerInstanceDeleteOperator` :param instance_id: The Cloud Spanner instance ID. :type instance_id: str :param project_id: Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'gcp_conn_id'] .. method:: _validate_inputs(self) .. method:: execute(self, context) .. py:class:: CloudSpannerInstanceDatabaseQueryOperator(instance_id, database_id, query, project_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`airflow.models.BaseOperator` Executes an arbitrary DML query (INSERT, UPDATE, DELETE). .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudSpannerInstanceDatabaseQueryOperator` :param instance_id: The Cloud Spanner instance ID. :type instance_id: str :param database_id: The Cloud Spanner database ID. :type database_id: str :param query: The query or list of queries to be executed. Can be a path to a SQL file. :type query: str or list :param project_id: Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'database_id', 'query', 'gcp_conn_id'] .. attribute:: template_ext :annotation: = ['.sql'] .. method:: _validate_inputs(self) .. method:: execute(self, context) .. staticmethod:: sanitize_queries(queries) .. py:class:: CloudSpannerInstanceDatabaseDeployOperator(instance_id, database_id, ddl_statements, project_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`airflow.models.BaseOperator` Creates a new Cloud Spanner database, or if database exists, the operator does nothing. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudSpannerInstanceDatabaseDeployOperator` :param instance_id: The Cloud Spanner instance ID. :type instance_id: str :param database_id: The Cloud Spanner database ID. :type database_id: str :param ddl_statements: The string list containing DDL for the new database. :type ddl_statements: list[str] :param project_id: Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'database_id', 'ddl_statements', 'gcp_conn_id'] .. attribute:: template_ext :annotation: = ['.sql'] .. method:: _validate_inputs(self) .. method:: execute(self, context) .. py:class:: CloudSpannerInstanceDatabaseUpdateOperator(instance_id, database_id, ddl_statements, project_id=None, operation_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`airflow.models.BaseOperator` Updates a Cloud Spanner database with the specified DDL statement. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudSpannerInstanceDatabaseUpdateOperator` :param instance_id: The Cloud Spanner instance ID. :type instance_id: str :param database_id: The Cloud Spanner database ID. :type database_id: str :param ddl_statements: The string list containing DDL to apply to the database. :type ddl_statements: list[str] :param project_id: Optional, the ID of the project that owns the the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param operation_id: (Optional) Unique per database operation id that can be specified to implement idempotency check. :type operation_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'database_id', 'ddl_statements', 'gcp_conn_id'] .. attribute:: template_ext :annotation: = ['.sql'] .. method:: _validate_inputs(self) .. method:: execute(self, context) .. py:class:: CloudSpannerInstanceDatabaseDeleteOperator(instance_id, database_id, project_id=None, gcp_conn_id='google_cloud_default', *args, **kwargs) Bases::class:`airflow.models.BaseOperator` Deletes a Cloud Spanner database. .. seealso:: For more information on how to use this operator, take a look at the guide: :ref:`howto/operator:CloudSpannerInstanceDatabaseDeleteOperator` :param instance_id: Cloud Spanner instance ID. :type instance_id: str :param database_id: Cloud Spanner database ID. :type database_id: str :param project_id: Optional, the ID of the project that owns the Cloud Spanner Database. If set to None or missing, the default project_id from the GCP connection is used. :type project_id: str :param gcp_conn_id: The connection ID used to connect to Google Cloud Platform. :type gcp_conn_id: str .. attribute:: template_fields :annotation: = ['project_id', 'instance_id', 'database_id', 'gcp_conn_id'] .. method:: _validate_inputs(self) .. method:: execute(self, context)