airflow.providers.openlineage.utils.sql

属性

log

TablesHierarchy

ColumnIndex

枚举信息模式视图中的列索引。

TableSchema

用于构建 OpenLineage 数据集的临时对象。

函数

get_table_schemas(hook, namespace, schema, database, ...)

查询数据库以获取表模式。

parse_query_result(cursor)

从 DB-API 2.0 游标中获取结果并创建表模式列表。

create_information_schema_query(columns, ...[, ...])

创建用于从信息模式中获取表模式的查询。

create_filter_clauses(mapping, information_schema_table)

为一个数据库中的所有表创建综合过滤子句。

模块内容

airflow.providers.openlineage.utils.sql.log[source]
class airflow.providers.openlineage.utils.sql.ColumnIndex[source]

Bases: enum.IntEnum

枚举信息模式视图中的列索引。

SCHEMA = 0[source]
TABLE_NAME = 1[source]
COLUMN_NAME = 2[source]
ORDINAL_POSITION = 3[source]
UDT_NAME = 4[source]
DATABASE = 5[source]
airflow.providers.openlineage.utils.sql.TablesHierarchy[source]
class airflow.providers.openlineage.utils.sql.TableSchema[source]

用于构建 OpenLineage 数据集的临时对象。

table: str[source]
schema: str | None[source]
database: str | None[source]
fields: list[openlineage.client.facet_v2.schema_dataset.SchemaDatasetFacetFields][source]
to_dataset(namespace, database=None, schema=None)[source]
airflow.providers.openlineage.utils.sql.get_table_schemas(hook, namespace, schema, database, in_query, out_query)[source]

查询数据库以获取表模式。

使用提供的 hook。为该函数提供输入或输出表的查询是特定提取器的责任。如果未提供输入或输出表的查询,则跳过该查询。

airflow.providers.openlineage.utils.sql.parse_query_result(cursor)[source]

从 DB-API 2.0 游标中获取结果并创建表模式列表。

为每一行创建 TableSchema 对象。

airflow.providers.openlineage.utils.sql.create_information_schema_query(columns, information_schema_table_name, tables_hierarchy, uppercase_names=False, use_flat_cross_db_query=False, sqlalchemy_engine=None)[source]

创建用于从信息模式中获取表模式的查询。

airflow.providers.openlineage.utils.sql.create_filter_clauses(mapping, information_schema_table, uppercase_names=False)[source]

为一个数据库中的所有表创建综合过滤子句。

参数
  • mapping (dict) – 包含每个数据库中模式名称和表列表的嵌套字典

  • information_schema_table (sqlalchemy.Table) – 用于构建子句的 sqlalchemy.Table 实例。对于大多数 SQL 数据库,它包含 table_nametable_schema 列,因此期望该表已定义它们。

  • uppercase_names (bool) – 如果为 True,则使用大写的模式和表名

此条目是否有帮助?