SQLExecuteQueryOperator to connect to Presto

Use the SQLExecuteQueryOperator to execute Presto commands in a Presto database.

Using the Operator

Use the conn_id argument to connect to your Presto instance where the connection metadata is structured as follows:

Presto Airflow Connection Metadata

Parameter

Input

Host: string

Presto server hostname or container name

Schema: string

Schema to execute SQL operations on by default

Login: string

Presto user (required)

Password: string

Presto user password (if authentication is enabled)

Port: int

Presto server port (default: 8080)

Extra: JSON

Additional parameters such as {“user”: “airflow_user”}

An example usage of the SQLExecuteQueryOperator to connect to Presto is as follows:

presto/tests/system/presto/example_presto.py[source]


    # Example of creating a task that calls a common CREATE TABLE sql command.
    select_presto_task = SQLExecuteQueryOperator(
        task_id="select_presto",
        sql="SELECT 1",
    )

Reference

For further information, look at:

Note

Parameters given via SQLExecuteQueryOperator() are given first-place priority relative to parameters set via Airflow connection metadata (such as schema, login, password etc).

Was this entry helpful?