IcebergTableAdapter
An IcebergTableAdapter
is a class that manages an Iceberg table and provides methods to interact with it.
Constructors
The IcebergTableAdapter
class can be constructed directly:
import io.deephaven.iceberg.util.IcebergTableAdapter
adapter = IcebergTableAdapter(
org.apache.iceberg.catalog.Catalog catalog,
org.apache.iceberg.catalog.TableIdentifier tableIdentifier,
org.apache.iceberg.Table table,
DataInstructionsProviderLoader dataInstructionsProviderLoader,
Resolver resolver,
org.apache.iceberg.mapping.NameMapping nameMapping
)
It can also be constructed using an IcebergCatalogAdapter
load_table
method:
icebergTableAdapter = icebergCatalogAdapter.load_table(String tableIdentifier)
Parameters
If constructed directly, the parameters are:
catalog
: The Iceberg catalog to use.tableIdentifier
: The identifier of the Iceberg table.table
: The Iceberg table.dataInstructionsProviderLoader
: A loader for data instructions.resolver
: A resolver for the table.nameMapping
: The name mapping for the table.
If constructed using IcebergCatalogAdapter.load_table
, the parameter is:
tableIdentifier
: The identifier of the Iceberg table to load.
Methods
catalog
: Return the catalog used to access the Iceberg table.currentSchema
: Retrieve the current schema of the Iceberg table.currentSnapshot
: Get the current snapshot of the Iceberg table.definition
: Get the definition of the Iceberg table.definitionTable
: Get a table representation of the Iceberg table definition.getSnapshot
: Retrieve a specific snapshot of the Iceberg table by its ID.icebergTable
: Return the underlying Iceberg table.listSnapshots
: List all snapshots of the Iceberg table.locationUri
: Get the location URI of the Iceberg table.nameMapping
: Get the name mapping used for the Iceberg table.provider
: Return the table location provider.refresh
: Refresh the Iceberg table metadata.resolver
: Get the resolver for the Iceberg table.schema
: Get the identifier of the schema to load.schemas
: List all schemas of the Iceberg table as a Deephaven table.snapshots
: List all snapshots of the Iceberg table as a Deephaven table.table
: Read the latest snapshot of the Iceberg table as a Deephaven table.tableIdentifier
: Get the identifier of the Iceberg table.tableWriter
: Create a newIcebergTableWriter
for this Iceberg table using the provided options.toString
: Get a string representation of the Iceberg table adapter.
Examples
The following example constructs an IcebergCatalogAdapter
and uses it to create an IcebergTableAdapter
for a specific table. It uses the Docker deployment defined in the Deephaven and Iceberg guide.
import io.deephaven.iceberg.util.*
restAdapter = IcebergTools.createAdapter(
"minio-iceberg",
[
"type": "rest",
"uri": "http://rest:8181",
"client.region": "us-east-1",
"s3.access-key-id": "admin",
"s3.secret-access-key": "password",
"s3.endpoint": "http://minio:9000",
"io-impl": "org.apache.iceberg.aws.s3.S3FileIO"
]
)
staticInstructions = IcebergReadInstructions.builder()
.updateMode(IcebergUpdateMode.staticMode())
.build()
icebergTaxis = restAdapter.loadTable("nyc.taxis")
taxis = icebergTaxis.table(staticInstructions)