World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
title: "Manage Catalogs and Schemas" slug: "/manage-catalogs-and-schemas" keyword: "catalog management, schema management, catalog, schema, Gravitino" license: "This software is licensed under the Apache License version 2."
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Introduction
This page covers the Gravitino API for catalogs and schemas. For what a catalog and a schema are, the catalog types, what Gravitino stores, permissions, and how to work with them in the UI, see Catalogs and Schemas.
Connection properties differ by provider and are documented on each catalog type's own page.
Catalog Operations
Create a Catalog
A catalog needs a name, a type, and for most types a provider. Properties carry the connection details. The example below registers a Hive metastore; other providers take different properties.
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "sales",
"type": "RELATIONAL",
"provider": "hive",
"comment": "Sales estate",
"properties": {"metastore.uris": "thrift://localhost:9083"}
}' http://localhost:8090/api/metalakes/example/catalogs
GravitinoClient client = GravitinoClient
.builder("http://localhost:8090")
.withMetalake("example")
.build();
Catalog catalog = client.createCatalog(
"sales",
Catalog.Type.RELATIONAL,
"hive",
"Sales estate",
ImmutableMap.of("metastore.uris", "thrift://localhost:9083"));
catalog = client.create_catalog(
name="sales",
catalog_type=Catalog.Type.RELATIONAL,
provider="hive",
comment="Sales estate",
properties={"metastore.uris": "thrift://localhost:9083"})
Fileset and model catalogs are managed by Gravitino rather than federated, so they take no provider.
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "landing",
"type": "FILESET",
"comment": "Landing zone",
"properties": {"location": "s3a://example-bucket/landing"}
}' http://localhost:8090/api/metalakes/example/catalogs
Load a Catalog
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales
Catalog catalog = client.loadCatalog("sales");
catalog = client.load_catalog("sales")
Alter a Catalog
Changes are applied as a list in one request.
| Change | JSON | Java | Python |
|---|---|---|---|
| Rename | {"@type":"rename","newName":"sales_v2"} |
CatalogChange.rename("sales_v2") |
CatalogChange.rename("sales_v2") |
| Update the comment | {"@type":"updateComment","newComment":"new_comment"} |
CatalogChange.updateComment("new_comment") |
CatalogChange.update_comment("new_comment") |
| Set a property | {"@type":"setProperty","property":"key1","value":"value1"} |
CatalogChange.setProperty("key1", "value1") |
CatalogChange.set_property("key1", "value1") |
| Remove a property | {"@type":"removeProperty","property":"key1"} |
CatalogChange.removeProperty("key1") |
CatalogChange.remove_property("key1") |
curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"updates": [
{"@type": "updateComment", "newComment": "Sales estate, production"}
]
}' http://localhost:8090/api/metalakes/example/catalogs/sales
Catalog catalog = client.alterCatalog(
"sales", CatalogChange.updateComment("Sales estate, production"));
catalog = client.alter_catalog(
"sales", CatalogChange.update_comment("Sales estate, production"))
Enable or Disable a Catalog
A catalog that is not in use can only be listed, loaded, enabled, or dropped.
curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{"inUse": false}' \
http://localhost:8090/api/metalakes/example/catalogs/sales
client.disableCatalog("sales");
client.enableCatalog("sales");
client.disable_catalog("sales")
client.enable_catalog("sales")
Drop a Catalog
Without force, the catalog must have no schemas and must not be in use. With force, Gravitino
removes the registration and everything it holds about the contents.
curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales?force=false"
boolean dropped = client.dropCatalog("sales", false);
dropped = client.drop_catalog("sales", force=False)
List Catalogs
Detailed catalog listing includes resolved properties by default. To retrieve lightweight catalog
descriptors without resolving properties or initializing server-side catalog wrappers, use
details=true&includeProperties=false in REST, listCatalogsInfo(false) in Java, or
list_catalogs_info(include_properties=False) in Python. Descriptors retain
the name, type, provider, comment, and audit information. Their properties retain only in-use,
read directly from stored metadata and defaulting to "true" when absent, so enabled and disabled
catalogs remain distinguishable without initializing catalog wrappers. Use descriptors for discovery
only. Load a catalog before reading, comparing, or altering its properties.
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs?details=true"
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs?details=true&includeProperties=false"
String[] catalogNames = client.listCatalogs();
Catalog[] catalogs = client.listCatalogsInfo();
Catalog[] catalogDescriptors = client.listCatalogsInfo(false);
catalog_names = client.list_catalogs()
catalogs = client.list_catalogs_info()
catalog_descriptors = client.list_catalogs_info(include_properties=False)
Schema Operations
Schema operations are the same for every catalog type. Creating a schema through Gravitino creates it in the source system too, where the source supports that.
Create a Schema
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "public",
"comment": "Shared datasets",
"properties": {}
}' http://localhost:8090/api/metalakes/example/catalogs/sales/schemas
Catalog catalog = client.loadCatalog("sales");
Schema schema = catalog.asSchemas().createSchema(
"public", "Shared datasets", Collections.emptyMap());
catalog = client.load_catalog("sales")
schema = catalog.as_schemas().create_schema(
schema_name="public", comment="Shared datasets", properties={})
Load a Schema
If schema creation reports that the source object was created but Gravitino registration failed,
resolve the entity-store error and verify the source object's identity. Use loadSchema (or the
load-schema REST API below) to import the existing object. Repeating createSchema returns an
already-exists error; creation is not automatically replayed. Secrets referenced by the created
object are retained. Import reads the properties available from the source; if that source omits
secret references, reconcile those references separately before deleting any retained secrets.
Creating an external schema with an existing Gravitino registration is rejected before source creation. External schema creation now checks the entity store before calling the source; a failed registration lookup stops creation without issuing source DDL. Managed schema creation does not perform this additional lookup. A different source identifier does not prove that the old object was deleted: it may have been renamed. Loading a renamed schema within the same catalog preserves its registered identity only after confirming that the old source path no longer exists. If the old path still exists, the copied identifier is rejected; imports cannot move an identity from another catalog. Gravitino does not support metadata-only unregister of an individual external schema. Follow the catalog-specific recovery guidance before resetting a catalog; catalog re-registration clears all of its stored registrations and governance associations, which must be reapplied as described in the migration guide. Conflicting registrations are never automatically cascade-deleted by an overwrite. A concurrent registration after the preflight can still cause a partial create failure, since source creation and the entity-store write are not one transaction.
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public
Schema schema = catalog.asSchemas().loadSchema("public");
schema = catalog.as_schemas().load_schema("public")
Alter a Schema
A schema takes property changes only. It cannot be renamed, and its comment cannot be changed.
| Change | JSON | Java | Python |
|---|---|---|---|
| Set a property | {"@type":"setProperty","property":"key1","value":"value1"} |
SchemaChange.setProperty("key1", "value1") |
SchemaChange.set_property("key1", "value1") |
| Remove a property | {"@type":"removeProperty","property":"key1"} |
SchemaChange.removeProperty("key1") |
SchemaChange.remove_property("key1") |
curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"updates": [
{"@type": "setProperty", "property": "owner", "value": "sales-eng"}
]
}' http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public
Schema schema = catalog.asSchemas().alterSchema(
"public", SchemaChange.setProperty("owner", "sales-eng"));
schema = catalog.as_schemas().alter_schema(
"public", SchemaChange.set_property("owner", "sales-eng"))
Drop a Schema
Without cascade, the schema must be empty. With cascade, everything inside it goes as well.
curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public?cascade=false"
boolean dropped = catalog.asSchemas().dropSchema("public", false);
dropped = catalog.as_schemas().drop_schema("public", cascade=False)
List Schemas
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales/schemas
String[] schemaNames = catalog.asSchemas().listSchemas();
schema_names = catalog.as_schemas().list_schemas()