airflow.providers.google.cloud.operators.datafusion

This module contains Google DataFusion operators.

Module Contents

Classes

DataFusionPipelineLinkHelper

Helper class for Pipeline links.

CloudDataFusionRestartInstanceOperator

Restart a single Data Fusion instance.

CloudDataFusionDeleteInstanceOperator

Deletes a single Date Fusion instance.

CloudDataFusionCreateInstanceOperator

Creates a new Data Fusion instance in the specified project and location.

CloudDataFusionUpdateInstanceOperator

Updates a single Data Fusion instance.

CloudDataFusionGetInstanceOperator

Gets details of a single Data Fusion instance.

CloudDataFusionCreatePipelineOperator

Creates a Cloud Data Fusion pipeline.

CloudDataFusionDeletePipelineOperator

Deletes a Cloud Data Fusion pipeline.

CloudDataFusionListPipelinesOperator

Lists Cloud Data Fusion pipelines.

CloudDataFusionStartPipelineOperator

Starts a Cloud Data Fusion pipeline. Works for both batch and stream pipelines.

CloudDataFusionStopPipelineOperator

Stops a Cloud Data Fusion pipeline. Works for both batch and stream pipelines.

class airflow.providers.google.cloud.operators.datafusion.DataFusionPipelineLinkHelper[source]

Helper class for Pipeline links.

static get_project_id(instance)[source]
class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionRestartInstanceOperator(*, instance_name, location, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Restart a single Data Fusion instance.

At the end of an operation instance is fully restarted.

See also

For more information on how to use this operator, take a look at the guide: Restart DataFusion Instance

Parameters
  • instance_name (str) – The name of the instance to restart.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • project_id (str | None) – The ID of the Google Cloud project that the instance belongs to.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionDeleteInstanceOperator(*, instance_name, location, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Deletes a single Date Fusion instance.

See also

For more information on how to use this operator, take a look at the guide: Delete DataFusion Instance

Parameters
  • instance_name (str) – The name of the instance to restart.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • project_id (str | None) – The ID of the Google Cloud project that the instance belongs to.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionCreateInstanceOperator(*, instance_name, instance, location, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Creates a new Data Fusion instance in the specified project and location.

See also

For more information on how to use this operator, take a look at the guide: Create DataFusion Instance

Parameters
  • instance_name (str) – The name of the instance to create.

  • instance (dict[str, Any]) – An instance of Instance. https://cloud.google.com/data-fusion/docs/reference/rest/v1beta1/projects.locations.instances#Instance

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • project_id (str | None) – The ID of the Google Cloud project that the instance belongs to.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'instance', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionUpdateInstanceOperator(*, instance_name, instance, update_mask, location, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Updates a single Data Fusion instance.

See also

For more information on how to use this operator, take a look at the guide: Update DataFusion Instance

Parameters
  • instance_name (str) – The name of the instance to create.

  • instance (dict[str, Any]) – An instance of Instance. https://cloud.google.com/data-fusion/docs/reference/rest/v1beta1/projects.locations.instances#Instance

  • update_mask (str) – Field mask is used to specify the fields that the update will overwrite in an instance resource. The fields specified in the updateMask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask, all the supported fields (labels and options currently) will be overwritten. A comma-separated list of fully qualified names of fields. Example: “user.displayName,photo”. https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?_ga=2.205612571.-968688242.1573564810#google.protobuf.FieldMask

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • project_id (str | None) – The ID of the Google Cloud project that the instance belongs to.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'instance', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionGetInstanceOperator(*, instance_name, location, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Gets details of a single Data Fusion instance.

See also

For more information on how to use this operator, take a look at the guide: Get DataFusion Instance

Parameters
  • instance_name (str) – The name of the instance.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • project_id (str | None) – The ID of the Google Cloud project that the instance belongs to.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionCreatePipelineOperator(*, pipeline_name, pipeline, instance_name, location, namespace='default', project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Creates a Cloud Data Fusion pipeline.

See also

For more information on how to use this operator, take a look at the guide: Create a DataFusion pipeline

Parameters
  • pipeline_name (str) – Your pipeline name.

  • pipeline (dict[str, Any]) – The pipeline definition. For more information check: https://docs.cdap.io/cdap/current/en/developer-manual/pipelines/developing-pipelines.html#pipeline-configuration-file-format

  • instance_name (str) – The name of the instance.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • namespace (str) – If your pipeline belongs to a Basic edition instance, the namespace ID is always default. If your pipeline belongs to an Enterprise edition instance, you can create a namespace.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'pipeline_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionDeletePipelineOperator(*, pipeline_name, instance_name, location, version_id=None, namespace='default', project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Deletes a Cloud Data Fusion pipeline.

See also

For more information on how to use this operator, take a look at the guide: Delete a DataFusion pipeline

Parameters
  • pipeline_name (str) – Your pipeline name.

  • version_id (str | None) – Version of pipeline to delete

  • instance_name (str) – The name of the instance.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • namespace (str) – If your pipeline belongs to a Basic edition instance, the namespace ID is always default. If your pipeline belongs to an Enterprise edition instance, you can create a namespace.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'version_id', 'pipeline_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionListPipelinesOperator(*, instance_name, location, artifact_name=None, artifact_version=None, namespace='default', project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Lists Cloud Data Fusion pipelines.

See also

For more information on how to use this operator, take a look at the guide: List DataFusion pipelines

Parameters
  • instance_name (str) – The name of the instance.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • artifact_version (str | None) – Artifact version to filter instances

  • artifact_name (str | None) – Artifact name to filter instances

  • namespace (str) – If your pipeline belongs to a Basic edition instance, the namespace ID is always default. If your pipeline belongs to an Enterprise edition instance, you can create a namespace.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'artifact_name', 'artifact_version', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionStartPipelineOperator(*, pipeline_name, instance_name, location, runtime_args=None, success_states=None, namespace='default', pipeline_timeout=5 * 60, project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, asynchronous=False, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), poll_interval=3.0, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Starts a Cloud Data Fusion pipeline. Works for both batch and stream pipelines.

See also

For more information on how to use this operator, take a look at the guide: Start a DataFusion pipeline

Parameters
  • pipeline_name (str) – Your pipeline name.

  • instance_name (str) – The name of the instance.

  • success_states (list[str] | None) – If provided the operator will wait for pipeline to be in one of the provided states.

  • pipeline_timeout (int) – How long (in seconds) operator should wait for the pipeline to be in one of success_states. Works only if success_states are provided.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • runtime_args (dict[str, Any] | None) – Optional runtime args to be passed to the pipeline

  • namespace (str) – If your pipeline belongs to a Basic edition instance, the namespace ID is always default. If your pipeline belongs to an Enterprise edition instance, you can create a namespace.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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).

  • asynchronous – Flag to return after submitting the pipeline ID to the Data Fusion API. This is useful for submitting long-running pipelines and waiting on them asynchronously using the CloudDataFusionPipelineStateSensor

  • deferrable (bool) – Run operator in the deferrable mode. Is not related to asynchronous parameter. While asynchronous parameter gives a possibility to wait until pipeline reaches terminate state using sleep() method, deferrable mode checks for the state using asynchronous calls. It is not possible to use both asynchronous and deferrable parameters at the same time.

  • poll_interval – Polling period in seconds to check for the status. Used only in deferrable mode.

template_fields: Sequence[str] = ('instance_name', 'pipeline_name', 'runtime_args', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event)[source]

Callback for when the trigger fires - returns immediately.

Relies on trigger to throw an exception, otherwise it assumes execution was successful.

class airflow.providers.google.cloud.operators.datafusion.CloudDataFusionStopPipelineOperator(*, pipeline_name, instance_name, location, namespace='default', project_id=None, api_version='v1beta1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

Bases: airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator

Stops a Cloud Data Fusion pipeline. Works for both batch and stream pipelines.

See also

For more information on how to use this operator, take a look at the guide: Stop a DataFusion pipeline

Parameters
  • pipeline_name (str) – Your pipeline name.

  • instance_name (str) – The name of the instance.

  • location (str) – The Cloud Data Fusion location in which to handle the request.

  • namespace (str) – If your pipeline belongs to a Basic edition instance, the namespace ID is always default. If your pipeline belongs to an Enterprise edition instance, you can create a namespace.

  • api_version (str) – The version of the api that will be requested for example ‘v3’.

  • gcp_conn_id (str) – The connection ID to use when fetching connection info.

  • impersonation_chain (str | 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. 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] = ('instance_name', 'pipeline_name', 'impersonation_chain')[source]
execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?