Catalog

Catalog is the entry point for accessing iceberg tables. You can use a catalog to:

  • Create and list namespaces.
  • Create, load, and drop tables

SessionCatalog offers the same operations, but takes a SessionContext with each call instead of binding one for the lifetime of the catalog. It is currently implemented by the REST catalog only.

There is support for the following catalogs:

CatalogDescription
Restthe Iceberg REST catalog
Gluethe AWS Glue Data Catalog
Memorya memory-based Catalog
HMSApache Iceberg HiveMetaStore catalog
S3TablesAWS S3 Tables
SQLSQL-based catalog

Not all catalog implementations are complete.

REST catalog APIs

The REST catalog provides two interfaces:

  • RestCatalog implements Catalog and binds one SessionContext to every operation.
  • RestSessionCatalog implements SessionCatalog and accepts a context with each operation.

REST configuration, authentication, and the HTTP client are shared by the catalog instance.

RestCatalog

Here is an example of how to create a RestCatalog:

{{#rustdoc_include ../../crates/examples/src/rest_catalog_namespace.rs:create_catalog}}

You can run following code to list all root namespaces:

{{#rustdoc_include ../../crates/examples/src/rest_catalog_namespace.rs:list_all_namespace}}

Then you can run following code to create namespace:

{{#rustdoc_include ../../crates/examples/src/rest_catalog_namespace.rs:create_namespace}}

RestSessionCatalog

Use RestSessionCatalog when the caller supplies a session context for each operation. Build the catalog and the context it should run under:

{{#rustdoc_include ../../crates/examples/src/rest_session_catalog_namespace.rs:create_catalog}}

Every operation then takes that context. You can run following code to list all root namespaces:

{{#rustdoc_include ../../crates/examples/src/rest_session_catalog_namespace.rs:list_all_namespace}}

Then you can run following code to create namespace:

{{#rustdoc_include ../../crates/examples/src/rest_session_catalog_namespace.rs:create_namespace}}

Table

After creating Catalog, we can manipulate tables through Catalog.

You can use following code to create a table:

{{#rustdoc_include ../../crates/examples/src/rest_catalog_table.rs:create_table}}

Also, you can load a table directly:

{{#rustdoc_include ../../crates/examples/src/rest_catalog_table.rs:load_table}}