Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#2761] fix(docs): update docs after separating the Gravitino java client to two clients (#2763)

Shaofeng Shi15443039113e
diff --git a/docs/manage-metalake-using-gravitino.md b/docs/manage-metalake-using-gravitino.md
index 335c6dbb67..24699352f5 100644
--- a/docs/manage-metalake-using-gravitino.md
+++ b/docs/manage-metalake-using-gravitino.md
@@ -22,7 +22,7 @@ Assuming Gravitino has just started, and the host and port is [http://localhost:
### Create a metalake
-You can create a metalake by sending a `POST` request to the `/api/metalakes` endpoint or just use the Gravitino Java client.
+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:
<Tabs>
@@ -38,10 +38,11 @@ http://localhost:8090/api/metalakes
<TabItem value="java" label="Java">
```java
-GravitinoClient gravitinoClient = GravitinoClient
+GravitinoAdminClient gravitinoAdminClient = GravitinoAdminClient
.builder("http://127.0.0.1:8090")
.build();
-GravitinoMetaLake newMetalake = gravitinoClient.createMetalake(
+
+GravitinoMetaLake newMetalake = gravitinoAdminClient.createMetalake(
NameIdentifier.of("metalake"),
"This is a new metalake",
new HashMap<>());
@@ -68,7 +69,7 @@ curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-GravitinoMetaLake loaded = gravitinoClient.loadMetalake(
+GravitinoMetaLake loaded = gravitinoAdminClient.loadMetalake(
NameIdentifier.of("metalake"));
// ...
```
@@ -105,7 +106,7 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-GravitinoMetaLake renamed = gravitinoClient.alterMetalake(
+GravitinoMetaLake renamed = gravitinoAdminClient.alterMetalake(
NameIdentifier.of("new_metalake"),
MetalakeChange.rename("new_metalake_renamed")
);
@@ -143,7 +144,7 @@ curl -X DELETE -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-boolean success = gravitinoClient.dropMetalake(
+boolean success = gravitinoAdminClient.dropMetalake(
NameIdentifier.of("metalake")
);
// ...
@@ -174,7 +175,7 @@ curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-GravitinoMetaLake[] allMetalakes = gravitinoClient.listMetalakes();
+GravitinoMetaLake[] allMetalakes = gravitinoAdminClient.listMetalakes();
// ...
```
diff --git a/docs/manage-relational-metadata-using-gravitino.md b/docs/manage-relational-metadata-using-gravitino.md
index b40a627440..aa5a3ed382 100644
--- a/docs/manage-relational-metadata-using-gravitino.md
+++ b/docs/manage-relational-metadata-using-gravitino.md
@@ -61,20 +61,19 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
<TabItem value="java" label="Java">
```java
+
+// Assuming you have just created a metalake named `metalake`
GravitinoClient gravitinoClient = GravitinoClient
.builder("http://127.0.0.1:8090")
+ .withMetalake("metalake")
.build();
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
Map<String, String> hiveProperties = ImmutableMap.<String, String>builder()
// You should replace the following with your own hive metastore uris that Gravitino can access
.put("metastore.uris", "thrift://localhost:9083")
.build();
-Catalog catalog = gravitinoMetaLake.createCatalog(
+Catalog catalog = gravitinoClient.createCatalog(
NameIdentifier.of("metalake", "catalog"),
Type.RELATIONAL,
"hive", // provider, We support hive, jdbc-mysql, jdbc-postgresql, lakehouse-iceberg, etc.
@@ -112,11 +111,8 @@ curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+// Assuming you have created a metalake named `metalake` and a catalog named `catalog`
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "catalog"));
// ...
```
@@ -152,11 +148,8 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
-Catalog catalog = gravitinoMetaLake.alterCatalog(NameIdentifier.of("metalake", "catalog"),
+// Assuming you have created a metalake named `metalake` and a catalog named `catalog`
+Catalog catalog = gravitinoClient.alterCatalog(NameIdentifier.of("metalake", "catalog"),
CatalogChange.rename("alter_catalog"), CatalogChange.updateComment("new comment"));
// ...
```
@@ -191,12 +184,10 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog
```java
// ...
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-gravitinoMetaLake.dropCatalog(NameIdentifier.of("metalake", "catalog"));
+// Assuming you have created a metalake named `metalake` and a catalog named `catalog`
+gravitinoClient.dropCatalog(NameIdentifier.of("metalake", "catalog"));
// ...
- // ...
+
```
</TabItem>
@@ -226,10 +217,7 @@ http://localhost:8090/api/metalakes/metalake/catalogs
```java
// ...
// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
-NameIdentifier[] catalogsIdents = gravitinoMetaLake.listCatalogs(Namespace.ofCatalog("metalake"));
+NameIdentifier[] catalogsIdents = gravitinoClient.listCatalogs(Namespace.ofCatalog("metalake"));
// ...
```
@@ -255,9 +243,6 @@ http://localhost:8090/api/metalakes/metalake/catalogs?details=true
```java
// ...
// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
Catalog[] catalogsInfos = gravitinoMetaLake.listCatalogsInfo(Namespace.ofCatalog("metalake"));
// ...
```
@@ -294,23 +279,15 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
<TabItem value="java" label="Java">
```java
-GravitinoClient gravitinoClient = GravitinoClient
- .builder("http://127.0.0.1:8090")
- .build();
-
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
-// Assuming you have just created a Hive catalog named `catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+// Assuming you have just created a Hive catalog named `hive_catalog`
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
SupportsSchemas supportsSchemas = catalog.asSchemas();
Map<String, String> schemaProperties = ImmutableMap.<String, String>builder()
.build();
Schema schema = supportsSchemas.createSchema(
- NameIdentifier.of("metalake", "catalog", "schema"),
+ NameIdentifier.of("metalake", "hive_catalog", "schema"),
"This is a schema",
schemaProperties
);
@@ -348,9 +325,9 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
SupportsSchemas supportsSchemas = catalog.asSchemas();
-Schema schema = supportsSchemas.loadSchema(NameIdentifier.of("metalake", "catalog", "schema"));
+Schema schema = supportsSchemas.loadSchema(NameIdentifier.of("metalake", "hive_catalog", "schema"));
// ...
```
@@ -386,7 +363,7 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
SupportsSchemas supportsSchemas = catalog.asSchemas();
@@ -425,11 +402,11 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema?cas
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
SupportsSchemas supportsSchemas = catalog.asSchemas();
// cascade can be true or false
-supportsSchemas.dropSchema(NameIdentifier.of("metalake", "catalog", "schema"), true);
+supportsSchemas.dropSchema(NameIdentifier.of("metalake", "hive_catalog", "schema"), true);
```
</TabItem>
@@ -458,10 +435,10 @@ curl -X GET -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
SupportsSchemas supportsSchemas = catalog.asSchemas();
-NameIdentifier[] schemas = supportsSchemas.listSchemas(Namespace.ofSchema("metalake", "catalog"));
+NameIdentifier[] schemas = supportsSchemas.listSchemas(Namespace.ofSchema("metalake", "hive_catalog"));
```
</TabItem>
@@ -609,16 +586,8 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
<TabItem value="java" label="Java">
```java
-GravitinoClient gravitinoClient = GravitinoClient
- .builder("http://127.0.0.1:8090")
- .build();
-
-// Assuming you have just created a metalake named `metalake`
-GravitinoMetaLake gravitinoMetaLake =
- gravitinoClient.loadMetalake(NameIdentifier.of("metalake"));
-
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
TableCatalog tableCatalog = catalog.asTableCatalog();
@@ -630,7 +599,7 @@ Map<String, String> tablePropertiesMap = ImmutableMap.<String, String>builder()
.build();
tableCatalog.createTable(
- NameIdentifier.of("metalake", "catalog", "schema", "example_table"),
+ NameIdentifier.of("metalake", "hive_catalog", "schema", "example_table"),
new Column[] {
Column.of("id", Types.IntegerType.get(), "id column comment", false, true, Literals.integerLiteral(-1)),
Column.of("name", Types.VarCharType.of(500), "name column comment", true, false, Literals.NULL),
@@ -794,8 +763,8 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
-// Assuming you have just created a Hive catalog named `catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+// Assuming you have just created a Hive catalog named `hive_catalog`
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
TableCatalog tableCatalog = catalog.asTableCatalog();
tableCatalog.loadTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "table"));
@@ -838,12 +807,12 @@ curl -X PUT -H "Accept: application/vnd.gravitino.v1+json" \
```java
// ...
-// Assuming you have just created a Hive catalog named `catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+// Assuming you have just created a Hive catalog named `hive_catalog`
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
TableCatalog tableCatalog = catalog.asTableCatalog();
-Table t = tableCatalog.alterTable(NameIdentifier.of("metalake", "catalog", "schema", "table"),
+Table t = tableCatalog.alterTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "table"),
TableChange.rename("table_renamed"), TableChange.updateComment("xxx"));
// ...
```
@@ -888,15 +857,15 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
TableCatalog tableCatalog = catalog.asTableCatalog();
// Drop a table
-tableCatalog.dropTable(NameIdentifier.of("metalake", "catalog", "schema", "table"));
+tableCatalog.dropTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "table"));
// Purge a table
-tableCatalog.purgeTable(NameIdentifier.of("metalake", "catalog", "schema", "table"));
+tableCatalog.purgeTable(NameIdentifier.of("metalake", "hive_catalog", "schema", "table"));
// ...
```
@@ -929,11 +898,11 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
// ...
// Assuming you have just created a Hive catalog named `hive_catalog`
-Catalog catalog = gravitinoMetaLake.loadCatalog(NameIdentifier.of("metalake", "catalog"));
+Catalog catalog = gravitinoClient.loadCatalog(NameIdentifier.of("metalake", "hive_catalog"));
TableCatalog tableCatalog = catalog.asTableCatalog();
NameIdentifier[] identifiers =
- tableCatalog.listTables(Namespace.ofTable("metalake", "catalog", "schema"));
+ tableCatalog.listTables(Namespace.ofTable("metalake", "hive_catalog", "schema"));
// ...
```
diff --git a/docs/manage-table-partition-using-gravitino.md b/docs/manage-table-partition-using-gravitino.md
index 4035758a06..3b9ab3a596 100644
--- a/docs/manage-table-partition-using-gravitino.md
+++ b/docs/manage-table-partition-using-gravitino.md
@@ -249,12 +249,12 @@ curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
```java
GravitinoClient gravitinoClient = GravitinoClient
.builder("http://127.0.0.1:8090")
+ .withMetalake("metalake")
.build();
// Assume that you have a partitioned table named "metalake.catalog.schema.table".
Partition addedPartition =
gravitinoClient
- .loadMetalake(NameIdentifier.of("metalake"))
.loadCatalog(NameIdentifier.of("metalake", "catalog"))
.asTableCatalog()
.loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
@@ -294,12 +294,12 @@ If the partition name contains special characters, you should use [URL encoding]
```java
GravitinoClient gravitinoClient = GravitinoClient
.builder("http://127.0.0.1:8090")
+ .withMetalake("metalake")
.build();
// Assume that you have a partitioned table named "metalake.catalog.schema.table".
Partition Partition =
gravitinoClient
- .loadMetalake(NameIdentifier.of("metalake"))
.loadCatalog(NameIdentifier.of("metalake", "catalog"))
.asTableCatalog()
.loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
@@ -330,12 +330,12 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
```java
GravitinoClient gravitinoClient = GravitinoClient
.builder("http://127.0.0.1:8090")
+ .withMetalake("metalake")
.build();
// Assume that you have a partitioned table named "metalake.catalog.schema.table".
String[] partitionNames =
gravitinoClient
- .loadMetalake(NameIdentifier.of("metalake"))
.loadCatalog(NameIdentifier.of("metalake", "catalog"))
.asTableCatalog()
.loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
@@ -367,7 +367,6 @@ http://localhost:8090/api/metalakes/metalake/catalogs/catalog/schemas/schema/tab
// Assume that you have a partitioned table named "metalake.catalog.schema.table".
Partition[] partitions =
gravitinoClient
- .loadMetalake(NameIdentifier.of("metalake"))
.loadCatalog(NameIdentifier.of("metalake", "catalog"))
.asTableCatalog()
.loadTable(NameIdentifier.of("metalake", "catalog", "schema", "table"))
diff --git a/docs/security.md b/docs/security.md
index 5272192e58..7165a27d0f 100644
--- a/docs/security.md
+++ b/docs/security.md
@@ -22,6 +22,7 @@ For the client side, users can enable `simple` mode by the following code:
```java
GravitinoClient client = GravitinoClient.builder(uri)
+ .withMetalake("metalake")
.withSimpleAuth()
.build();
```
@@ -47,6 +48,7 @@ DefaultOAuth2TokenProvider authDataProvider = DefaultOAuth2TokenProvider.builder
.build();
GravitinoClient client = GravitinoClient.builder(uri)
+ .withMetalake("metalake")
.withOAuth(authDataProvider)
.build();
```
@@ -73,6 +75,7 @@ KerberosTokenProvider provider = KerberosTokenProvider.builder()
.build();
GravitinoClient client = GravitinoClient.builder(uri)
+ .withMetalake("metalake")
.withKerberosAuth(provider)
.build();
```
@@ -278,7 +281,7 @@ import com.datastrato.gravitino.client.GravitinoVersion;
public class Main {
public static void main(String[] args) {
String uri = "https://localhost:8433";
- GravitinoClient client = GravitinoClient.builder(uri).build();
+ GravitinoClient client = GravitinoClient.builder(uri).withMetalake("metalake").build();
GravitinoVersion gravitinoVersion = client.getVersion();
System.out.println(gravitinoVersion);
}