Skip to main content

Manage catalogs and schemas

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 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.

Create a Hive catalog
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

Fileset and model catalogs are managed by Gravitino rather than federated, so they take no provider.

Create a fileset catalog
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​

Load a catalog
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales

Alter​

Changes are applied as a list in one request.

ChangeJSONJavaPython
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")
Update a catalog comment
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

Enable or disable​

A catalog that is not in use can only be listed, loaded, enabled, or dropped.

Disable or enable a catalog
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

curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{"inUse": true}' \
http://localhost:8090/api/metalakes/example/catalogs/sales

Drop​

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.

Drop a catalog
curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales?force=false"

List​

List catalogs
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"

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​

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

Load​

Load a schema
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public

Alter​

A schema takes property changes only. It cannot be renamed, and its comment cannot be changed.

ChangeJSONJavaPython
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")
Set a schema property
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

Drop​

Without cascade, the schema must be empty. With cascade, everything inside it goes as well.

Drop a schema
curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
"http://localhost:8090/api/metalakes/example/catalogs/sales/schemas/public?cascade=false"

List​

List schemas
curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
http://localhost:8090/api/metalakes/example/catalogs/sales/schemas