Catalog is the entry point for accessing iceberg tables. You can use a catalog to:
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:
| Catalog | Description |
|---|---|
Rest | the Iceberg REST catalog |
Glue | the AWS Glue Data Catalog |
Memory | a memory-based Catalog |
HMS | Apache Iceberg HiveMetaStore catalog |
S3Tables | AWS S3 Tables |
SQL | SQL-based catalog |
Not all catalog implementations are complete.
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.
RestCatalogHere 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}}
RestSessionCatalogUse 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}}
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}}