airflow.providers.openlineage.utils.sql

模組內容

類別

ColumnIndex

列舉資訊綱要視圖中欄位的索引。

TableSchema

用於建構 OpenLineage 資料集的暫時物件。

函數

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

查詢資料庫以取得表格綱要。

parse_query_result(cursor)

從 DB-API 2.0 cursor 擷取結果並建立表格綱要列表。

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

建立從資訊綱要取得表格綱要的查詢。

create_filter_clauses(mapping, information_schema_table)

為單一資料庫中的所有表格建立全面的篩選子句。

屬性

log

TablesHierarchy

airflow.providers.openlineage.utils.sql.log[原始碼]
class airflow.providers.openlineage.utils.sql.ColumnIndex[原始碼]

基底類別: enum.IntEnum

列舉資訊綱要視圖中欄位的索引。

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

用於建構 OpenLineage 資料集的暫時物件。

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

查詢資料庫以取得表格綱要。

使用提供的 hook。提供此函數查詢的責任在於特定的提取器。如果未提供輸入或輸出表格的查詢,則會略過查詢。

airflow.providers.openlineage.utils.sql.parse_query_result(cursor)[原始碼]

從 DB-API 2.0 cursor 擷取結果並建立表格綱要列表。

針對每一列,它會建立 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)[原始碼]

建立從資訊綱要取得表格綱要的查詢。

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

為單一資料庫中的所有表格建立全面的篩選子句。

參數
  • mapping (dict) – 一個巢狀字典,包含資料庫、綱要名稱以及每個資料庫中的表格列表

  • information_schema_table (sqlalchemy.Table) – 用於建構子句的 sqlalchemy.Table 實例。對於大多數 SQL 資料庫,它包含 table_nametable_schema 欄位,因此預期表格已定義這些欄位。

  • uppercase_names (bool) – 若為 True,則使用大寫的綱要和表格名稱

此條目是否有幫助?