airflow.providers.mysql.transfers.presto_to_mysql

PrestoToMySqlOperator

将数据从 Presto 移动到 MySQL。

模块内容

class airflow.providers.mysql.transfers.presto_to_mysql.PrestoToMySqlOperator(*, sql, mysql_table, presto_conn_id='presto_default', mysql_conn_id='mysql_default', mysql_preoperator=None, **kwargs)[source]

基类: airflow.models.BaseOperator

将数据从 Presto 移动到 MySQL。

注意,目前数据在推送到 MySQL 之前会加载到内存中,因此此 operator 应该用于处理少量数据。

参数:
  • sql (str) – 要在 Presto 上执行的 SQL 查询。(模板化)

  • mysql_table (str) – 目标 MySQL 表,使用点表示法指定特定数据库。(模板化)

  • mysql_conn_id (str) – mysql 连接 ID 的引用。

  • presto_conn_id (str) – 源 presto 连接

  • 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]
presto_conn_id = 'presto_default'[source]
execute(context)[source]

创建 operator 时派生此方法。

Context 是与渲染 jinja 模板时使用的字典相同。

有关更多上下文,请参阅 get_template_context。

此条目有用吗?