World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[MINOR] Improvement(docs): Support multiple language tab in `manage-metadata-using-gravitino` docs (#1105)
Qi Yu4118c41cf113
diff --git a/docs/manage-metadata-using-gravitino.md b/docs/manage-metadata-using-gravitino.mdindex 559a5ac0ff..9b5be7dfaa 100644--- a/docs/manage-metadata-using-gravitino.md+++ b/docs/manage-metadata-using-gravitino.md@@ -6,6 +6,9 @@ keyword: Gravitino metadata managelicense: Copyright 2023 Datastrato Pvt Ltd. This software is licensed under the Apache License version 2.---+import Tabs from '@theme/Tabs';+import TabItem from '@theme/TabItem';+This page introduces how to manage metadata by Gravitino. Through Gravitino, you can create, edit, and delete metadatalike metalakes, catalogs, schemas, and tables. The following contents are included in this page:@@ -27,12 +30,18 @@ Assuming Gravitino has just started, and the host and port is `http://localhost:You can create a metalake by sending a `POST` request to the `/api/metalakes` endpoint or just use the Gravitino Java client.The following is an example of creating a metalake:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -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```+</TabItem>+<TabItem value="java" label="Java">+```javaGravitinoClient gravitinoClient = GravitinoClient.builder("http://127.0.0.1:8090")@@ -44,15 +53,25 @@ GravitinoMetaLake newMetalake = gravitinoClient.createMetalake(// ...```+</TabItem>+</Tabs>+### Load a metalakeYou 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:++<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake```+</TabItem>+<TabItem value="java" label="Java">+```java// ...GravitinoMetaLake loaded = gravitinoClient.loadMetalake(@@ -60,10 +79,16 @@ GravitinoMetaLake loaded = gravitinoClient.loadMetalake(// ...```+</TabItem>+</Tabs>+### Alter a metalakeYou 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:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -81,6 +106,9 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/new_metalake```+</TabItem>+<TabItem value="java" label="Java">+```java// ...GravitinoMetaLake renamed = gravitinoClient.alterMetalake(@@ -90,6 +118,10 @@ GravitinoMetaLake renamed = gravitinoClient.alterMetalake(// ...```+</TabItem>+</Tabs>++Currently, Gravitino supports the following changes to a metalake:| Supported modification | Json | Java |@@ -104,10 +136,16 @@ Currently, Gravitino supports the following changes to 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:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake-````+```++</TabItem>+<TabItem value="java" label="Java">```java// ...@@ -117,6 +155,9 @@ boolean success = gravitinoClient.dropMetalake(// ...```+</TabItem>+</Tabs>+:::noteDrop a metalake only removes metadata about the metalake and catalogs, schemas, tables under the metalake in Gravitino, It doesn't remove the real schema and table data in Apache Hive.:::@@ -125,17 +166,26 @@ Drop a metalake only removes metadata about the metalake and catalogs, schemas,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 name:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" http://localhost:8090/api/metalakes```+</TabItem>+<TabItem value="java" label="Java">+```java// ...GravitinoMetaLake[] allMetalakes = gravitinoClient.listMetalakes();// ...```+</TabItem>+</Tabs>+## Catalogs operations### Create a catalog@@ -148,6 +198,10 @@ The code below is an example of creating a Hive catalog. For other catalogs, theYou can create a catalog by sending a `POST` request to the `/api/metalakes/{metalake_name}/catalogs` endpoint or just use the Gravitino Java client. The following is an example of creating a catalog:++<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X POST -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -161,6 +215,9 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs```+</TabItem>+<TabItem value="java" label="Java">+```javaGravitinoClient gravitinoClient = GravitinoClient.builder("http://127.0.0.1:8090")@@ -184,6 +241,9 @@ Catalog catalog = gravitinoMetaLake.createCatalog(// ...```+</TabItem>+</Tabs>+Currently, Gravitino supports the following catalog providers:| Catalog provider | Catalog property |@@ -197,11 +257,17 @@ Currently, Gravitino supports the following catalog providers:You can load a catalog by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or just use the Gravitino Java client. The following is an example of loading a catalog:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake/catalogs/catalog```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a metalake named `metalake`@@ -212,10 +278,16 @@ Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "c// ...```+</TabItem>+</Tabs>+### Alter a catalogYou can modify a catalog by sending a `PUT` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or just use the Gravitino Java client. The following is an example of altering a catalog:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -233,6 +305,9 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a metalake named `metalake`@@ -244,6 +319,9 @@ Catalog catalog = gravitinoMetaLake.alterCatalog(NameIdentifier.of("metalake", "// ...```+</TabItem>+</Tabs>+Currently, Gravitino supports the following changes to a catalog:| Supported modification | Json | Java |@@ -257,12 +335,18 @@ Currently, Gravitino supports the following changes to a catalog:You can remove a catalog by sending a `DELETE` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}` endpoint or just use the Gravitino Java client. The following is an example of dropping a catalog:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" \http://localhost:8090/api/metalakes/metalake/catalogs/catalog```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a metalake named `metalake`@@ -270,8 +354,12 @@ GravitinoMetaLake gravitinoMetaLake =gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));gravitinoMetaLake.dropCatalog(NameIdentifier.of("metalake", "catalog"));// ...+ // ...```+</TabItem>+</Tabs>+:::noteDrop a catalog only removes metadata about the catalog and schemas, tables under the catalog in Gravitino, It doesn't remove the real data(table and schema) in Apache Hive.:::@@ -281,12 +369,18 @@ Drop a catalog only removes metadata about the catalog and schemas, tables underYou can list all catalogs under a metalake by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs` endpoint or just use the Gravitino Java client. The following is an example of listing all catalogs ina metalake:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" \http://localhost:8090/api/metalakes/metalake/catalogs```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a metalake named `metalake`@@ -297,6 +391,9 @@ NameIdentifier[] catalogsIdents = gravitinoMetaLake.listCatalogs(Namespace.ofCat// ...```+</TabItem>+</Tabs>+## Schemas operations:::tip@@ -307,6 +404,9 @@ Users should create a metalake and a catalog before creating a schema.You can create a schema by sending a `POST` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas` endpoint or just use the Gravitino Java client. The following is an example of creating a schema:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X POST -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -318,6 +418,9 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas```+</TabItem>+<TabItem value="java" label="Java">+```javaGravitinoClient gravitinoClient = GravitinoClient.builder("http://127.0.0.1:8090")@@ -342,6 +445,9 @@ Schema schema = supportsSchemas.createSchema(// ...```+</TabItem>+</Tabs>+Currently, Gravitino supports the following schema property:| Catalog provider | Schema property |@@ -357,12 +463,18 @@ Currently, Gravitino supports the following schema property:You can create a schema by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}` endpoint or just use the Gravitino Java client. The following is an example of loading a schema:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET \-H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" \http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -372,10 +484,16 @@ Schema schema = supportsSchemas.loadSchema(NameIdentifier.of("metalake", "catalo// ...```+</TabItem>+</Tabs>+### Alter a schemaYou can change a schema by sending a `PUT` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}` endpoint or just use the Gravitino Java client. The following is an example of modifying a schema:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -392,6 +510,9 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -405,6 +526,9 @@ Schema schema = supportsSchemas.alterSchema(NameIdentifier.of("metalake", "hive_// ...```+</TabItem>+</Tabs>+Currently, Gravitino supports the following changes to a schema:| Supported modification | Json | Java |@@ -416,6 +540,8 @@ Currently, Gravitino supports the following changes to a schema:### Drop a schemaYou can remove a schema by sending a `DELETE` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}` endpoint or just use the Gravitino Java client. The following is an example of dropping a schema:+<Tabs>+<TabItem value="bash" label="Bash">```bash// cascade can be true or false@@ -424,6 +550,9 @@ curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema?cascade=true```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -434,16 +563,26 @@ SupportsSchemas supportsSchemas = catalog.asSchemas();supportsSchemas.dropSchema(NameIdentifier.of("metalake", "catalog", "schema"), true);```+</TabItem>+</Tabs>+### List all schemas under a catalogYou can alter all schemas under a catalog by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas` endpoint or just use the Gravitino Java client. The following is an example of list all schemain a catalog:++<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -453,6 +592,9 @@ SupportsSchemas supportsSchemas = catalog.asSchemas();NameIdentifier[] schemas = supportsSchemas.listSchemas(Namespace.ofSchema("metalake", "catalog"));```+</TabItem>+</Tabs>+## Tables operations:::tip@@ -463,6 +605,9 @@ Users should create a metalake, a catalog and a schema before creating a table.You can create a table by sending a `POST` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}/tables` endpoint or just use the Gravitino Java client. The following is an example of creating a table:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X POST -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -488,6 +633,9 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables```+</TabItem>+<TabItem value="java" label="Java">+```javaGravitinoClient gravitinoClient = GravitinoClient.builder("http://127.0.0.1:8090")@@ -529,6 +677,9 @@ tableCatalog.createTable();```+</TabItem>+</Tabs>+In order to create a table, you need to provide the following information:- Table column name and type@@ -593,6 +744,9 @@ In addition to the basic settings, Gravitino supports the following features:The following is an example of creating a partitioned, bucketed table and sorted order table:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X POST -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -656,6 +810,9 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables```+</TabItem>+<TabItem value="java" label="Java">+```javatableCatalog.createTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "table"),@@ -709,6 +866,9 @@ tableCatalog.createTable();```+</TabItem>+</Tabs>+:::noteThe code above is an example of creating a Hive table. For other catalogs, the code is similar, but the supported column type, table properties may be different. For more details, please refer to the related doc.:::@@ -717,13 +877,18 @@ The code above is an example of creating a Hive table. For other catalogs, the cYou can load a table by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}` endpoint or just use the Gravitino Java client. The following is an example of loading a table:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" \http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables/table-```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `catalog`@@ -734,10 +899,16 @@ tableCatalog.loadTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "// ...```+</TabItem>+</Tabs>+### Alter a tableYou can modify a table by sending a `PUT` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}` endpoint or just use the Gravitino Java client. The following is an example of modifying a table:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" -d '{@@ -753,6 +924,9 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \}' http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables/table```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `catalog`@@ -765,6 +939,9 @@ Table t = tableCatalog.alterTable(NameIdentifier.of("metalake", "catalog", "sche// ...```+</TabItem>+</Tabs>+Currently, Gravitino supports the following changes to a table:| Supported modification | Json | Java |@@ -785,11 +962,18 @@ Currently, Gravitino supports the following changes to a table:You can remove a table by sending a `DELETE` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}` endpoint or just use the Gravitino Java client. The following is an example of dropping a table:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \--H "Content-Type: application/json" http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables/table+-H "Content-Type: application/json" \+http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables/table```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -800,16 +984,25 @@ tableCatalog.dropTable(NameIdentifier.of("metalake", "catalog", "schema", "table// ...```+</TabItem>+</Tabs>+### List all tables under a schemaYou can list all tables in a schema by sending a `GET` request to the `/api/metalakes/{metalake_name}/catalogs/{catalog_name}/schemas/{schema_name}/tables` endpoint or just use the Gravitino Java client. The following is an example of list all tables in a schema:+<Tabs>+<TabItem value="bash" label="Bash">+```bashcurl -X GET -H "Accept: application/vnd.gravitino.v1+json" \-H "Content-Type: application/json" \http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tables```+</TabItem>+<TabItem value="java" label="Java">+```java// ...// Assuming you have just created a Hive catalog named `hive_catalog`@@ -819,4 +1012,7 @@ TableCatalog tableCatalog = catalog.asTableCatalog();NameIdentifier[] identifiers =tableCatalog.listTables(Namespace.ofTable("metalake", "catalog", "schema"));// ...-```\ No newline at end of file+```++</TabItem>+</Tabs>\ No newline at end of file