SQLExecuteQueryOperator 连接到 Presto

使用 SQLExecuteQueryOperatorPresto 数据库中执行 Presto 命令。

使用操作符

使用 conn_id 参数连接到您的 Presto 实例,连接元数据结构如下:

Presto Airflow 连接元数据

参数

输入

主机: string

Presto 服务器主机名或容器名

模式: string

默认执行 SQL 操作的模式

登录: string

Presto 用户 (必需)

密码: string

Presto 用户密码 (如果启用了身份验证)

端口: int

Presto 服务器端口 (默认: 8080)

额外: JSON

附加参数,例如 {“user”: “airflow_user”}

SQLExecuteQueryOperator 连接到 Presto 的一个示例用法如下:

tests/system/presto/example_presto.py


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

参考

更多信息,请参阅

注意

通过 SQLExecuteQueryOperator() 提供的参数相对于通过 Airflow 连接元数据设置的参数(例如 schemaloginpassword 等)具有更高的优先级。

此条目有帮助吗?