airflow.providers.google.cloud.transfers.bigquery_to_bigquery

This module contains Google BigQuery to BigQuery operator.

Module Contents

Classes

BigQueryToBigQueryOperator

Copies data from one BigQuery table to another.

class airflow.providers.google.cloud.transfers.bigquery_to_bigquery.BigQueryToBigQueryOperator(*, source_project_dataset_tables, destination_project_dataset_table, write_disposition='WRITE_EMPTY', create_disposition='CREATE_IF_NEEDED', gcp_conn_id='google_cloud_default', labels=None, encryption_configuration=None, location=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Copies data from one BigQuery table to another.

See also

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

See also

For more details about these parameters: https://cloud.google.com/bigquery/docs/reference/v2/jobs#configuration.copy

Parameters
  • source_project_dataset_tables (list[str] | str) – One or more dotted (project:|project.)<dataset>.<table> BigQuery tables to use as the source data. If <project> is not included, project will be the project defined in the connection json. Use a list if there are multiple source tables. (templated)

  • destination_project_dataset_table (str) – The destination BigQuery table. Format is: (project:|project.)<dataset>.<table> (templated)

  • write_disposition (str) – The write disposition if the table already exists.

  • create_disposition (str) – The create disposition if the table doesn’t exist.

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

  • labels (dict | None) – a dictionary containing labels for the job/query, passed to BigQuery

  • encryption_configuration (dict | None) –

    [Optional] Custom encryption configuration (e.g., Cloud KMS keys).

    encryption_configuration = {
        "kmsKeyName": "projects/testp/locations/us/keyRings/test-kr/cryptoKeys/test-key",
    }
    

  • location (str | None) – The geographic location of the job. You must specify the location to run the job if the location to run a job is not in the US or the EU multi-regional location or the location is in a single region (for example, us-central1). For more details check: https://cloud.google.com/bigquery/docs/locations#specifying_your_location

  • 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. 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: collections.abc.Sequence[str] = ('source_project_dataset_tables', 'destination_project_dataset_table', 'labels', 'impersonation_chain')[source]
template_ext: collections.abc.Sequence[str] = ('.sql',)[source]
ui_color = '#e6f0e4'[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.

get_openlineage_facets_on_complete(task_instance)[source]

Implement on_complete as we will include final BQ job id.

Was this entry helpful?