Skip to main content
Version: 1.3.1

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​

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

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

Alter a Catalog​

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")
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​

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

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"

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

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")
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 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"

List Schemas​

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