Skip to main content

Manage metalakes

Introduction​

This page covers the Gravitino API for metalakes. For what a metalake is, what it isolates, the in-use behavior, deletion semantics, and permissions, see Metalakes.

Metalakes sit above any single metalake, so these operations use the admin client rather than the client used for everything inside one. Creating a metalake is reserved for service admins, configured with gravitino.authorization.serviceAdmins.

Metalake operations​

Create​

Create a metalake
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"name": "production",
"comment": "Production estate",
"properties": {}
}' http://localhost:8090/api/metalakes

Load​

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

Alter​

Changes are applied as a list in one request.

ChangeJSONJavaPython
Rename{"@type":"rename","newName":"metalake_renamed"}MetalakeChange.rename("metalake_renamed")MetalakeChange.rename("metalake_renamed")
Update the comment{"@type":"updateComment","newComment":"new_comment"}MetalakeChange.updateComment("new_comment")MetalakeChange.update_comment("new_comment")
Set a property{"@type":"setProperty","property":"key1","value":"value1"}MetalakeChange.setProperty("key1", "value1")MetalakeChange.set_property("key1", "value1")
Remove a property{"@type":"removeProperty","property":"key1"}MetalakeChange.removeProperty("key1")MetalakeChange.remove_property("key1")
Update the metalake comment
curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"updates": [
{"@type": "updateComment", "newComment": "Production estate, EMEA"}
]
}' http://localhost:8090/api/metalakes/production

Enable or disable​

A metalake that is not in use can only be listed, loaded, enabled, or dropped. Enabling one that is already in use does nothing, and the same is true of disabling one already out of use.

Enable or disable a metalake
curl -X PATCH -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{"inUse": false}' \
http://localhost:8090/api/metalakes/production

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

Drop​

Without force, the metalake must have no catalogs and must not be in use. With force, Gravitino removes the metalake and everything registered under it, whether or not it is in use. External systems are left alone; managed objects are removed with their data.

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

List​

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