SchemaProvider

The SchemaProvider class specifies which Iceberg schema to use when reading from or writing to an Iceberg table. It allows you to select a schema by its current state, by a specific snapshot, or by schema or snapshot ID. This is useful for advanced scenarios such as schema evolution and ensuring a specific schema mapping.

Syntax

Constructors

  • SchemaProvider.from_current()

    Use the current schema from the Iceberg table.

  • SchemaProvider.from_current_snapshot()

    Use the schema from the current snapshot of the Iceberg table.

  • SchemaProvider.from_schema_id(schema_id: int)

    Use the schema with the specified schema ID.

  • SchemaProvider.from_snapshot_id(snapshot_id: int)

    Use the schema from the specified snapshot ID.

Parameters

ParameterTypeDescription
schema_idint

The unique identifier of the Iceberg schema to use. Only required for from_schema_id.

snapshot_idint

The unique identifier of the Iceberg snapshot to use. Only required for from_snapshot_id.

Methods

None.

Examples

The following examples show how to create a SchemaProvider and use it with other Iceberg classes: