airflow.providers.mysql.transfers.trino_to_mysql

TrinoToMySqlOperator

將資料從 Trino 轉移到 MySQL。

模組內容

class airflow.providers.mysql.transfers.trino_to_mysql.TrinoToMySqlOperator(*, sql, mysql_table, trino_conn_id='trino_default', mysql_conn_id='mysql_default', mysql_preoperator=None, **kwargs)[source]

基類: airflow.models.BaseOperator

將資料從 Trino 轉移到 MySQL。

請注意,目前資料是先載入到記憶體中,然後才推送到 MySQL 的,因此此運算元應僅用於處理少量資料。

引數:
  • sql (str) – 在 Trino 中執行的 SQL 查詢。(模板化)

  • mysql_table (str) – 目標 MySQL 表,使用點表示法指定特定的資料庫。(模板化)

  • mysql_conn_id (str) – 參考 MySQL 連線 ID

  • trino_conn_id (str) – 源 Trino 連線

  • mysql_preoperator (str | None) – 在匯入資料之前在 MySQL 中執行的 SQL 語句,通常用於截斷或刪除現有資料,使任務具有冪等性(多次執行任務不會重複載入資料)。(模板化)

template_fields: collections.abc.Sequence[str] = ('sql', 'mysql_table', 'mysql_preoperator')[source]
template_ext: collections.abc.Sequence[str] = ('.sql',)[source]
template_fields_renderers[source]
ui_color = '#a0e08c'[source]
sql[source]
mysql_table[source]
mysql_conn_id = 'mysql_default'[source]
mysql_preoperator = None[source]
trino_conn_id = 'trino_default'[source]
execute(context)[source]

建立運算元時派生。

Context 與渲染 Jinja 模板時使用的字典相同。

有關更多 context 資訊,請參考 get_template_context。

本條目有幫助嗎?