airflow.providers.trino.transfers.gcs_to_trino

This module contains Google Cloud Storage to Trino operator.

Module Contents

Classes

GCSToTrinoOperator

Loads a csv file from Google Cloud Storage into a Trino table.

class airflow.providers.trino.transfers.gcs_to_trino.GCSToTrinoOperator(*, source_bucket, source_object, trino_table, trino_conn_id='trino_default', gcp_conn_id='google_cloud_default', schema_fields=None, schema_object=None, impersonation_chain=None, **kwargs)[source]

Bases: airflow.models.BaseOperator

Loads a csv file from Google Cloud Storage into a Trino table.

Assumptions: 1. CSV file should not have headers 2. Trino table with requisite columns is already created 3. Optionally, a separate JSON file with headers can be provided

Parameters
  • source_bucket (str) – Source GCS bucket that contains the csv

  • source_object (str) – csv file including the path

  • trino_table (str) – trino table to upload the data

  • trino_conn_id (str) – destination trino connection

  • gcp_conn_id (str) – (Optional) The connection ID used to connect to Google Cloud and interact with the Google Cloud Storage service.

  • schema_fields (Iterable[str] | None) – The names of the columns to fill in the table. If schema_fields is provided, any path provided in the schema object will be

  • schema_object (str | None) – JSON file with schema fields

  • 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.

template_fields: Sequence[str] = ('source_bucket', 'source_object', 'trino_table')[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?