Writes data to Apache Iceberg tables using daft. Supports table creation, schema inference, and multiple write modes.
IcebergOutput writes data to Apache Iceberg tables using daft. It supports table creation, schema inference, and multiple write modes. It inherits from the base Output class and provides specialized functionality for writing to Iceberg table format.
IcebergOutput
Classapplication_sdk.outputs.icebergOutputWrites data to Apache Iceberg tables using daft. Supports table creation, schema inference, and multiple write modes.
Methods3
__init__
__init__(self, iceberg_catalog: Catalog, iceberg_namespace: str, iceberg_table: Union[str, Table], mode: str = 'append', total_record_count: int = 0, chunk_count: int = 0, retain_local_copy: bool = False)Parameters
iceberg_catalogCatalogiceberg_namespacestriceberg_tableUnion[str, Table]modestrtotal_record_countintchunk_countintretain_local_copyboolwrite_dataframe
async write_dataframe(self, dataframe: pd.DataFrame) -> NoneParameters
dataframepd.DataFramewrite_daft_dataframe
async write_daft_dataframe(self, dataframe: daft.DataFrame) -> NoneParameters
dataframedaft.DataFrameUsage Examples
Initialize with catalog and table name
Create IcebergOutput with catalog and table name - table is created if it doesn't exist
from application_sdk.outputs import IcebergOutput
from pyiceberg.catalog import Catalog
iceberg_output = IcebergOutput(
iceberg_catalog=catalog,
iceberg_namespace="default",
iceberg_table="my_table",
mode="append"
)
await iceberg_output.write_dataframe(df)
Initialize with existing table object
Use existing PyIceberg Table object
from pyiceberg.table import Table
table = catalog.load_table("default.my_table")
iceberg_output = IcebergOutput(
iceberg_catalog=catalog,
iceberg_namespace="default",
iceberg_table=table,
mode="overwrite"
)
Usage patterns
For detailed usage patterns including writing to Iceberg tables, automatic table creation, using existing table objects, write modes, and other IcebergOutput-specific features, see Output usage patterns and select the IcebergOutput tab.
See also
- Outputs: Base Output class and common usage patterns for all output types
- ParquetOutput: Write data to Parquet files with chunking and Hive partitioning
- JsonOutput: Write data to JSON files in JSONL format