Google Cloud Storage to Trino Transfer Operator

Google has a service Google Cloud Storage. This service is used to store large data from various applications.

Trino is an open source, fast, distributed SQL query engine for running interactive analytic queries against data sources of all sizes ranging from gigabytes to petabytes. Trino allows querying data where it lives, including Hive, Cassandra, relational databases or even proprietary data stores. A single Trino query can combine data from multiple sources, allowing for analytics across your entire organization.

Load CSV from GCS to Trino Table

To load a CSV file from Google Cloud Storage to a Trino table you can use the GCSToTrinoOperator.

This operator assumes that CSV does not have headers and the data is corresponding to the columns in a pre-existing presto table. Optionally, you can provide schema as tuple/list of strings or as a path to a JSON file in the same bucket as the CSV file.

tests/system/trino/example_gcs_to_trino.py[source]

gcs_csv_to_trino_table = GCSToTrinoOperator(
    task_id="gcs_csv_to_trino_table",
    source_bucket=BUCKET,
    source_object=PATH_TO_FILE,
    trino_table=TRINO_TABLE,
)

Was this entry helpful?