airflow.providers.apache.iceberg.hooks.iceberg¶
Attributes¶
Classes¶
Hook for Apache Iceberg REST catalogs. |
Module Contents¶
- class airflow.providers.apache.iceberg.hooks.iceberg.IcebergHook(iceberg_conn_id=default_conn_name)[source]¶
Bases:
airflow.providers.common.compat.sdk.BaseHookHook for Apache Iceberg REST catalogs.
Provides catalog-level operations (list namespaces, list tables, load schemas) using pyiceberg, plus OAuth2 token generation for external query engines.
- Parameters:
iceberg_conn_id (str) – The Iceberg connection id which refers to the information to connect to the Iceberg catalog.
- classmethod get_ui_field_behaviour()[source]¶
Return custom UI field behaviour for Iceberg connection.
- property catalog: pyiceberg.catalog.Catalog[source]¶
Return a pyiceberg Catalog instance for the configured connection.
- get_token()[source]¶
Obtain a short-lived OAuth2 access token.
This preserves the legacy behavior of the pre-2.0
get_conn()method. Use this when you need a raw token for external engines (Spark, Trino, Flink).
- load_table(table_name)[source]¶
Load an Iceberg table object.
- Parameters:
table_name (str) – Fully-qualified table name (“namespace.table”).
- Returns:
pyiceberg Table instance.
- Return type:
pyiceberg.table.Table
- get_table_schema(table_name, **kwargs)[source]¶
Return column names and types for an Iceberg table.
Compatible with the
DbApiHook.get_table_schema()contract so that LLM operators can use this hook interchangeably for schema context.- Parameters:
table_name (str) – Fully-qualified table name (“namespace.table”).
- Returns:
List of dicts with
nameandtypekeys.- Return type:
Example return value:
[ {"name": "id", "type": "long"}, {"name": "name", "type": "string"}, {"name": "created_at", "type": "timestamptz"}, ]
- get_partition_spec(table_name)[source]¶
Return the partition spec for an Iceberg table.
- Parameters:
table_name (str) – Fully-qualified table name.
- Returns:
List of dicts with
fieldandtransformkeys.- Return type:
Example:
[ {"field": "event_date", "transform": "day"}, {"field": "region", "transform": "identity"}, ]
- get_table_properties(table_name)[source]¶
Return table properties (format version, write config, etc.).
- Parameters:
table_name (str) – Fully-qualified table name.