Google Cloud Storage to Presto Transfer Operator

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

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

Load CSV from GCS to Presto Table

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

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/providers/presto/example_gcs_to_presto.py[source]

gcs_csv_to_presto_table = GCSToPrestoOperator(
    task_id="gcs_csv_to_presto_table",
    source_bucket=BUCKET,
    source_object=PATH_TO_FILE,
    presto_table=PRESTO_TABLE,
)

Was this entry helpful?