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 等)具有更高的優先順序。

此條目有幫助嗎?