Skip to main content
Version: 0.5.0

Manage metalake using Gravitino

This page introduces how to manage metalake by Gravitino. Metalake is a tenant-like concept in Gravitino, all the catalogs, users and roles are under a metalake. Typically, a metalake is mapping to a organization or a company.

Through Gravitino, you can create, edit, and delete metalake. This page includes the following contents:

Assuming Gravitino has just started, and the host and port is http://localhost:8090.

Metalake operations

Create a metalake

You can create a metalake by sending a POST request to the /api/metalakes endpoint or just use the Gravitino Admin Java client. The following is an example of creating a metalake:

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

Load a metalake

You can create a metalake by sending a GET request to the /api/metalakes/{metalake_name} endpoint or just use the Gravitino Java client. The following is an example of loading a metalake:

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

Alter a metalake

You can modify a metalake by sending a PUT request to the /api/metalakes/{metalake_name} endpoint or just use the Gravitino Java client. The following is an example of altering a metalake:

curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" -d '{
"updates": [
{
"@type": "rename",
"newName": "metalake"
},
{
"@type": "setProperty",
"property": "key2",
"value": "value2"
}
]
}' http://localhost:8090/api/metalakes/new_metalake

Currently, Gravitino supports the following changes to a metalake:

Supported modificationJSONJava
Rename metalake{"@type":"rename","newName":"metalake_renamed"}MetalakeChange.rename("metalake_renamed")
Update comment{"@type":"updateComment","newComment":"new_comment"}MetalakeChange.updateComment("new_comment")
Set a property{"@type":"setProperty","property":"key1","value":"value1"}MetalakeChange.setProperty("key1", "value1")
Remove a property{"@type":"removeProperty","property":"key1"}MetalakeChange.removeProperty("key1")

Drop a metalake

You can remove a metalake by sending a DELETE request to the /api/metalakes/{metalake_name} endpoint or just use the Gravitino Java client. The following is an example of dropping a metalake:

curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake
note

Current Gravitino doesn't support dropping a metalake in cascade mode, which means all the catalogs, schemas and tables under the metalake need to be removed before dropping the metalake.

List all metalakes

You can list metalakes by sending a GET request to the /api/metalakes endpoint or just use the Gravitino Java client. The following is an example of listing all metalake names:

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