diff --git a/docs/cli.md b/docs/cli.md index e6e2f5aa609..f81b86b702d 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -8,25 +8,29 @@ last_update: license: 'This software is licensed under the Apache License version 2.' --- -This document provides guidance on managing metadata within Apache Gravitino using the Command Line Interface (CLI). The CLI offers a terminal based alternative to using code or the REST interface for metadata management. +This document provides guidance on managing metadata within Apache Gravitino using +the Command Line Interface (CLI). The CLI offers a terminal based alternative to +using code or the REST API for metadata management. -Currently, the CLI allows users to view metadata information for metalakes, catalogs, schemas, tables, users, roles, groups, tags, topics and filesets. Future updates will expand on these capabilities. +Currently, the CLI allows users to view metadata information for metalakes, catalogs, +schemas, tables, users, roles, groups, tags, topics and filesets. +Future updates will expand on these capabilities. ## Running the CLI -You can configure an alias for the CLI for ease of use, with the following command: +You can configure an alias for the CLI for ease of use. ```bash alias gcli='java -jar ../../cli/build/libs/gravitino-cli-*-incubating-SNAPSHOT.jar' ``` -Or you use the `gcli.sh` script found in the `clients/cli/bin/` directory to run the CLI. +Or you use the `gcli.sh` script located in the `clients/cli/bin/` directory. ## Usage -The general structure for running commands with the Gravitino CLI is `gcli entity command [options]`. +The general syntax for the Gravitino CLI is `gcli entity command [options]`. - ```bash +```none usage: gcli [metalake|catalog|schema|table|column|user|group|tag|topic|fileset] [list|details|create|delete|update|set|remove|properties|revoke|grant] [options] Options usage: gcli @@ -64,54 +68,60 @@ The general structure for running commands with the Gravitino CLI is `gcli entit -x,--index display index information -z,--provider provider one of hadoop, hive, mysql, postgres, iceberg, kafka - ``` +``` -## Commands +## Commands Actions The following commands are used for entity management: -- list: List available entities -- details: Show detailed information about an entity -- create: Create a new entity -- delete: Delete an existing entity -- update: Update an existing entity -- set: Set a property on an entity -- remove: Remove a property from an entity -- properties: Display an entities properties +- `list`: List available entities +- `details`: Show detailed information about an entity +- `create`: Create a new entity +- `delete`: Delete an existing entity +- `update`: Update an existing entity +- `set`: Set a property on an entity +- `remove`: Remove a property from an entity +- `properties`: Display an entities properties ### Setting the Metalake name -As dealing with one Metalake is a typical scenario, you can set the Metalake name in several ways so it doesn't need to be passed on the command line. +Considering that managing a metalake is a typical scenario, you can set the metalake +name in several ways so it doesn't need to be passed on the command line. -1. Passed in on the command line via the `--metalake` parameter. -2. Set via the `GRAVITINO_METALAKE` environment variable. -3. Stored in the Gravitino CLI configuration file. +1. Specify the `--metalake` argument on the command line. +1. Set the `GRAVITINO_METALAKE` environment variable. +1. Place it in the Gravitino [CLI configuration file](#config-file). -The command line option overrides the environment variable and the environment variable overrides the configuration file. +The command line option overrides the environment variable and the environment variable +takes precedence over the configuration file. ### Setting the Gravitino URL -As you need to set the Gravitino URL for every command, you can set the URL in several ways. +To avoid specifying the Gravitino URL using `--url` argument for every command, +you can persist the URL setting. -1. Passed in on the command line via the `--url` parameter. -2. Set via the 'GRAVITINO_URL' environment variable. -3. Stored in the Gravitino CLI configuration file. +1. Set the `GRAVITINO_URL` environment variable. +1. Place it in the Gravitino [CLI configuration file](#config-file). -The command line option overrides the environment variable and the environment variable overrides the configuration file. +The command line option overrides the environment variable and the environment variable +overrides the configuration file. ### Setting the Gravitino Authentication Type The authentication type can also be set in several ways. -1. Passed in on the command line via the `--simple` flag. -2. Set via the 'GRAVITINO_AUTH' environment variable. -3. Stored in the Gravitino CLI configuration file. +1. Specify the `--simple` argument in the command line. +1. Set the `GRAVITINO_AUTH` environment variable. +1. Place it in the Gravitino [CLI configuration file](#config-file). -### Gravitino CLI configuration file + -The gravitino CLI can read commonly used CLI options from a configuration file. By default, the file is `.gravitino` in the user's home directory. The metalake, URL and ignore parameters can be set in this file. +### Gravitino CLI configuration file {#config-file} -```text +The gravitino CLI can read commonly used CLI options from a configuration file. +By default, the file is `.gravitino` in the user's home directory. + +```ini # # Gravitino CLI configuration file # @@ -127,12 +137,12 @@ ignore=true # Authentication auth=simple - ``` -OAuth authentication can also be configured via the configuration file. +The OAuth authentication can also be configured in the configuration file, +as shown in the following example: -```text +```ini # Authentication auth=oauth serverURI=http://127.0.0.1:1082 @@ -141,9 +151,10 @@ token=test scope=token/test ``` -Kerberos authentication can also be configured via the configuration file. +The Kerberos authentication can be configured in the configuration file, +as shown in the following example: -```text +```ini # Authentication auth=kerberos principal=user/admin@foo.com @@ -152,283 +163,214 @@ keytabFile=file.keytab ### Potentially unsafe operations -For operations that delete data or rename a metalake the user with be prompted to make sure they wish to run this command. The `--force` option can be specified to override this behaviour. +For operations that delete data or rename a metalake, the users will be prompted to +make sure they wish to run this command. +The `--force` option can be specified to override this behaviour. ### Manage metadata All the commands are performed by using the [Java API](api/java-api) internally. -### Display help +### Show help -To display help on command usage: +To view the help on command usage: ```bash gcli --help ``` -### Display client version - -To display the client version: - -```bash -gcli --version -``` - -### Display server version +### Show version -To display the server version: +`gcli --version` +: Show the client version. -```bash -gcli --server -``` +`gcli --server` +: Show the server version. -### Client/server version mismatch +:::note +**Client/server version mismatch** -If the client and server are running different versions of the Gravitino software then you may need to ignore the client/server version check for the command to run. This can be done in several ways: +If the client and server are running different versions of the Gravitino software, +you may need to ignore the client/server version check for the command to be run. +This can be done in several ways: -1. Passed in on the command line via the `--ignore` parameter. -2. Set via the `GRAVITINO_IGNORE` environment variable. -3. Stored in the Gravitino CLI configuration file. +1. Specify the `--ignore` argument in the command line. +1. Set the `GRAVITINO_IGNORE` environment variable. +1. Place it in the Gravitino CLI configuration file. +::: ### Multiple properties For commands that accept multiple properties they can be specified in a couple of different ways: -1. gcli --properties n1=v1,n2=v2,n3=v3 - -2. gcli --properties n1=v1 n2=v2 n3=v3 - -3. gcli --properties n1=v1 --properties n2=v2 --properties n3=v3 +1. `gcli --properties n1=v1,n2=v2,n3=v3` +1. `gcli --properties n1=v1 n2=v2 n3=v3` +1. `gcli --properties n1=v1 --properties n2=v2 --properties n3=v3` ### Setting properties and tags - Different options are needed to add a tag and set a property of a tag with `gcli tag set`. To add a - tag, specify the tag (via --tag) and the entity to tag (via --name). To set the property of a tag - (via --tag) you need to specify the property (via --property) and value (via --value) you want to - set. +Different options are needed to add a tag or to set a property for a tag using `gcli tag set`. +To add a tag, specify the tag (via `--tag`) and the entity to tag (via `--name`). +To set the property of a tag (via `--tag`) you need to specify the property (via `--property`) +and value (via `--value`) you want to set. - To delete a tag, again, you need to specify the tag and entity, to remove a tag's property you need - to select the tag and property. +To delete a tag, again, you need to specify the tag and the entity; to remove a tag's property, +you need to select the tag and property. -### CLI commands +## Command examples -Please set the metalake in the Gravitino configuration file or the environment variable before running any of these commands. +Please set the metalake in the Gravitino configuration file or the environment variable before +running any of these commands. ### Metalake commands -#### Show all metalakes - -```bash -gcli metalake list -``` - -#### Show a metalake details - -```bash -gcli metalake details -``` - -#### Show a metalake's audit information - -```bash -gcli metalake details --audit -``` - -#### Create a metalake - -```bash -gcli metalake create --metalake my_metalake --comment "This is my metalake" -``` +`gcli metalake create --metalake --comment ` +: Create a metalake. -#### Delete a metalake +`gcli metalake properties` +: Show the properties for a metalake. -```bash -gcli metalake delete -``` - -#### Rename a metalake - -```bash -gcli metalake update --rename demo -``` +`gcli metalake delete` +: Delete a metalake. -#### Update a metalake's comment +`gcli metalake list` +: List all metalakes -```bash -gcli metalake update --comment "new comment" -``` +`gcli metalake details` +: Check the details of a specific a metalake. -#### Display a metalake's properties - -```bash -gcli metalake properties -``` +`gcli metalake details --audit` +: Show the audit information for a metalake -#### Set a metalake's property +`gcli metalake update --rename ` +: Rename a metalake -```bash -gcli metalake set --property test --value value -``` +`gcli metalake update --comment ""` +: Update the comment for a metalake -#### Remove a metalake's property +`gcli metalake set --property --value ` +: Set the property for a metalake. -```bash -gcli metalake remove --property test -``` +`gcli metalake remove --property ` +: Remove the specified property from a metalake. ### Catalog commands -#### Show all catalogs in a metalake - -```bash -gcli catalog list -``` - -#### Show a catalog details - -```bash -gcli catalog details --name catalog_postgres -``` +`gcli catalog list` +: Show all catalogs in a metalake -#### Show a catalog's audit information +`gcli catalog details --name ` +: Show a catalog details -```bash -gcli catalog details --name catalog_postgres --audit -``` +`gcli catalog details --name --audit` +: Show a catalog audit information #### Creating a catalog -The type of catalog to be created is specified by the `--provider` option. Different catalogs require different properties, for example, a Hive catalog requires a metastore-uri property. - -##### Create a Hive catalog - -```bash -gcli catalog create --name hive --provider hive --properties metastore.uris=thrift://hive-host:9083 -``` - -##### Create an Iceberg catalog - -```bash -gcli catalog create -name iceberg --provider iceberg --properties uri=thrift://hive-host:9083,catalog-backend=hive,warehouse=hdfs://hdfs-host:9000/user/iceberg/warehouse -``` - -##### Create a MySQL catalog - -```bash -gcli catalog create -name mysql --provider mysql --properties jdbc-url=jdbc:mysql://mysql-host:3306?useSSL=false,jdbc-user=user,jdbc-password=password,jdbc-driver=com.mysql.cj.jdbc.Driver -``` +The type of catalog to be created is specified by the `--provider` option. -##### Create a Postgres catalog +`gcli catalog create --provider hive --name --properties ` +: Create a catalog. -```bash -gcli catalog create -name postgres --provider postgres --properties jdbc-url=jdbc:postgresql://postgresql-host/mydb,jdbc-user=user,jdbc-password=password,jdbc-database=db,jdbc-driver=org.postgresql.Driver -``` +Different catalogs require different properties. +For example, a Hive catalog requires a `--metastore-uris` property. + +- For a Hive catalog, you need to specify the `metastore.uris` property. For example: -##### Create a Kafka catalog + `metastore.uris=thrift://hive-host:9083` -```bash -gcli catalog create --name kafka --provider kafka --properties bootstrap.servers=127.0.0.1:9092,127.0.0.2:9092 -``` +- For an Icebeg catalog, you need to specify the `uri`property. For example: -##### Create a Doris catalog + `uri=thrift://hive-host:9083,catalog-backend=hive,warehouse=hdfs://hdfs-host:9000/user/iceberg/warehouse` -```bash -gcli catalog create --name doris --provider doris --properties jdbc-url=jdbc:mysql://localhost:9030,jdbc-driver=com.mysql.jdbc.Driver,jdbc-user=admin,jdbc-password=password -``` +- For a MySQL Postgres catalog, you need to specify the `jdbc-url`, `jdbc-user`, `jdbc-password`, + `jdbc-driver` property. For example: -##### Create a Paimon catalog + `jdbc-url=jdbc:mysql://mysql-host:3306?useSSL=false,jdbc-user=user,jdbc-password=password,jdbc-driver=com.mysql.cj.jdbc.Driver` + +- For a Postgres catalog, you need to specify the `jdbc-url`, `jdbc-user`, `jdbc-password`, + `jdbc-driver`, `db` property. For example: -```bash -gcli catalog create --name paimon --provider paimon --properties catalog-backend=jdbc,uri=jdbc:mysql://127.0.0.1:3306/metastore_db,authentication.type=simple -``` + `jdbc-url=jdbc:postgresql://postgresql-host/mydb,jdbc-user=user,jdbc-password=password,jdbc-database=db,jdbc-driver=org.postgresql.Driver` -#### Create a Hudi catalog +- For a Kafka catalog, you need to specify the `boostrap.servers` property. For example: -```bash -gcli catalog create --name hudi --provider hudi --properties catalog-backend=hms,uri=thrift://127.0.0.1:9083 -``` + `bootstrap.servers=127.0.0.1:9092,127.0.0.2:9092` -#### Create an Oceanbase catalog +- For a Doris catalog, you need to specify the `jdbc-driver`, `jdbc-url`, `jdbc-user`, `jdb-password` property. + For example: -```bash -gcli catalog create --name oceanbase --provider oceanbase --properties jdbc-url=jdbc:mysql://localhost:2881,jdbc-driver=com.mysql.jdbc.Driver,jdbc-user=admin,jdbc-password=password -``` + `jdbc-url=jdbc:mysql://localhost:9030,jdbc-driver=com.mysql.jdbc.Driver,jdbc-user=admin,jdbc-password=password` -#### Delete a catalog +- For a Paimon catalog, you need to specify the `catalog-backend`, `uri`, `authentication.type` properties. + For example: -```bash -gcli catalog delete --name hive -``` + `catalog-backend=jdbc,uri=jdbc:mysql://127.0.0.1:3306/metastore_db,authentication.type=simple` -#### Rename a catalog +- For a Hudi catalog, you need to specify the `catalog-backend`, `uri` properties. For example: -```bash -gcli catalog update --name catalog_mysql --rename mysql -``` + `catalog-backend=hms,uri=thrift://127.0.0.1:9083` -#### Change a catalog comment +- For an Oceanbase catalog, you need to specify the `jdbc-driver`, `jdbc-url`, `jdbc-user`, and + `jdbc-password` properties. For example: -```bash -gcli catalog update --name catalog_mysql --comment "new comment" -``` + `jdbc-url=jdbc:mysql://localhost:2881,jdbc-driver=com.mysql.jdbc.Driver,jdbc-user=admin,jdbc-password=password` -#### Display a catalog's properties +`gcli catalog delete --name ` +: Delete a catalog. -```bash -gcli catalog properties --name catalog_mysql -``` +`gcli catalog update --name --rename ` +:Rename a catalog. -#### Set a catalog's property +`gcli catalog update --name --comment ""` +: Change the comment for a catalog. -```bash -gcli catalog set --name catalog_mysql --property test --value value -``` +`gcli catalog properties --name ` +: List the properties for a catalog. -#### Remove a catalog's property +`gcli catalog set --name --property --value ` +: Set a property for a catalog. -```bash -gcli catalog remove --name catalog_mysql --property test -``` +`gcli catalog remove --name --property ` +: Remove a property from a catalog. ### Schema commands -#### Show all schemas in a catalog - -```bash -gcli schema list --name catalog_postgres -``` - -#### Show schema details - -```bash -gcli schema details --name catalog_postgres.hr -``` - -#### Show schema's audit information - -```bash -gcli schema details --name catalog_postgres.hr --audit -``` +`gcli schema create --name ` +: Create a schema. -#### Create a schema +`gcli schema properties --name -i` +: Display the properties about a schema. -```bash -gcli schema create --name catalog_postgres.new_db -``` +`gcli schema list --name ` +: List all schemas in the specified catalog. -#### Display schema properties +`gcli schema details --name ` +: Show the details about schemas -```bash -gcli schema properties --name catalog_postgres.hr -``` +`gcli schema details --name --audit` +: Show schema audit information -Setting and removing schema properties is not currently supported by the Java API or the Gravitino CLI. +:::note +Setting and removing schema properties is currently not supported in the Java API +or the Gravitino CLI. +::: ### Table commands -When creating a table the columns are specified in CSV file specifying the name of the column, the datatype, a comment, true or false if the column is nullable, true or false if the column is auto incremented, a default value and a default type. Not all of the columns need to be specifed just the name and datatype columns. If not specified comment default to null, nullability to true and auto increment to false. If only the default value is specified it defaults to the same data type as the column. +When creating a table, the columns are specified in a CSV file containing the properties +of each column, including + +- the column name (required) +- the data type (required) +- the comment string that defaults to null +- a string format boolean indicating whether the column can be null (default=true) +- a string format boolean indicating whether the column is auto-incremented (default=false) +- the default value +- the default data type, defaults to the column data type if a default value is specified. + +Example CSV file: -Example CSV file ```text Name,Datatype,Comment,Nullable,AutoIncrement,DefaultValue,DefaultType name,String,person's name @@ -436,482 +378,294 @@ ID,Integer,unique id,false,true location,String,city they work in,false,false,Sydney,String ``` -#### Show all tables - -```bash -gcli table list --name catalog_postgres.hr -``` - -#### Show tables details - -```bash -gcli table details --name catalog_postgres.hr.departments -``` - -#### Show tables audit information - -```bash -gcli table details --name catalog_postgres.hr.departments --audit -``` - -#### Show tables distribution information -```bash -gcli table details --name catalog_postgres.hr.departments --distribution -``` - -#### Show tables partition information -```bash -gcli table details --name catalog_postgres.hr.departments --partition -``` - -#### Show tables sort order information -```bash -gcli table details --name catalog_postgres.hr.departments --sortorder -``` - -### Show table indexes +In the commands below, note that the table name is in the format +`..`. -```bash -gcli table details --name catalog_mysql.db.iceberg_namespace_properties --index -``` +`gcli table create --name
--comment "" --columnfile ` +: Create a table. Note that the table name is in the format `..
`. -#### Delete a table +`gcli table list --name ` +: List all tables for a schema. -```bash -gcli table delete --name catalog_postgres.hr.salaries -``` +`gcli table details --name
` +: Show the details about a table. +`gcli table details --name
--audit` +: Show the audit information for a specified table. -#### Display a tables's properties +`gcli table details --name
--distribution` +: Show distribution information for a specified table. -```bash -gcli table properties --name catalog_postgres.hr.salaries -``` +`gcli table details --name
--partition` +: Show the partition information for a specified table. -#### Set a tables's property +`gcli table details --name
--sortorder` +: Show the sorting order for the table specified. -```bash -gcli table set --name catalog_postgres.hr.salaries --property test --value value -``` +`gcli table details --name
--index` +: Show the index information for the table specified. -#### Remove a tables's property +`gcli table delete --name
` +: Delete a table. -```bash -gcli table remove --name catalog_postgres.hr.salaries --property test -``` +`gcli table properties --name
` +: Show the properties for a specific table. -#### Create a table +`gcli table set --name
--property --value ` +: Set a property for a specific table. -```bash -gcli table create --name catalog_postgres.hr.salaries --comment "comment" --columnfile ~/table.csv -``` +`gcli table remove --name
--property ` +: Remove the specified property from the specified table. ### User commands -#### Create a user - -```bash -gcli user create --user new_user -``` - -#### Show a user's details - -```bash -gcli user details --user new_user -``` - -#### List all users - -```bash -gcli user list -``` +`gcli user create --user ` +: Create a new user. -#### Show a roles's audit information +`gcli user details --user ` +: Show the details about the specified user. -```bash -gcli user details --user new_user --audit -``` +`gcli user details --user --audit` +: Show a roles's audit information -#### Delete a user +`gcli user list` +: List all users -```bash -gcli user delete --user new_user -``` +`gcli user delete --user ` +: Delete the specified user. ### Group commands -#### Create a group +`gcli group create --group ` +: Create a group. -```bash -gcli group create --group new_group -``` +`gcli group details --group ` +: Display the details about a group. -#### Display a group's details +`gcli group details --group new_group --audit` +: Show a groups's audit information. -```bash -gcli group details --group new_group -``` +`gcli group list` +: List all groups. -#### List all groups - -```bash -gcli group list -``` - -#### Show a groups's audit information - -```bash -gcli group details --group new_group --audit -``` - -#### Delete a group - -```bash -gcli group delete --group new_group -``` +`gcli group delete --group ` +: Delete a group. ### Tag commands -#### Display a tag's details - -```bash -gcli tag details --tag tagA -``` - -#### Create tags - -```bash -gcli tag create --tag tagA tagB -``` - -#### List all tags - -```bash -gcli tag list -``` - -#### Delete tags - -```bash -gcli tag delete --tag tagA tagB -``` - -#### Add tags to an entity - -```bash -gcli tag set --name catalog_postgres.hr --tag tagA tagB -``` - -#### Remove tags from an entity - -```bash -gcli tag remove --name catalog_postgres.hr --tag tagA tagB -``` - -#### Remove all tags from an entity - -```bash -gcli tag remove --name catalog_postgres.hr -``` +`gcli tag create --tag ` +: Create tags. -#### List all tags on an entity +`gcli tag details --tag ` +: Display the details about a tag. -```bash -gcli tag list --name catalog_postgres.hr -``` +`gcli tag list` +: List all tags. -#### List the properties of a tag +`gcli tag delete --tag ` +: Delete tags. -```bash -gcli tag properties --tag tagA -``` +`gcli tag set --name --tag tagA tagB` +: Add tags to an entity. The type of the entity is implied by its name. -#### Set a properties of a tag +`gcli tag remove --name --tag ` +: Remove tags from an entity. The type of the entity is implied by its name. -```bash -gcli tag set --tag tagA --property test --value value -``` +`gcli tag remove --name ` +: Remove all tags from an entity. The type of the entity is implied by its name. -#### Delete a property of a tag +`gcli tag list --name ` +: List all tags on an entity -```bash -gcli tag remove --tag tagA --property test -``` +`gcli tag properties --tag ` +: List the properties of a tag. -#### Rename a tag +`gcli tag set --tag --property --value ` +: Set a property for a tag. -```bash -gcli tag update --tag tagA --rename newTag -``` +`gcli tag remove --tag --property ` +: Delete a property from a tag. -#### Update a tag's comment +`gcli tag update --tag --rename ` +: Rename a tag. -```bash -gcli tag update --tag tagA --comment "new comment" -``` +`gcli tag update --tag --comment ""` +: Update the comment for a tag. ### Owner commands -#### List an owner - -```bash -gcli catalog details --owner --name postgres -``` - -#### Set an owner to a user - -```bash -gcli catalog set --owner --user admin --name postgres -``` +`gcli catalog details --name --owner` +: Show the details about the owner for a catalog. -#### Set an owner to a group +`gcli catalog set --name --owner --user ` +: Set the specified user as the owner of the specified catalog. -```bash -gcli catalog set --owner --group groupA --name postgres -``` +`gcli catalog set --name --owner --group ` +: Set the specified group as the owner of the catalog. ### Role commands When granting or revoking privileges the following privileges can be used. -create_catalog, use_catalog, create_schema, use_schema, create_table, modify_table, select_table, create_fileset, write_fileset, read_fileset, create_topic, produce_topic, consume_topic, manage_users, create_role, manage_grants +- `create_catalog` +- `use_catalog` +- `create_schema` +- `use_schema` +- `create_table` +- `modify_table` +- `select_table` +- `create_fileset` +- `write_fileset` +- `read_fileset` +- `create_topic` +- `produce_topic` +- `consume_topic` +- `manage_users` +- `create_role` +- `manage_grants` Note that some are only valid for certain entities. -#### Display role details - -```bash -gcli role details --role admin -``` - -#### List all roles - -```bash -gcli role list -``` - -#### Show a roles's audit information +`gcli role create --role ` +: Create a role. -```bash -gcli role details --role admin --audit -``` - -#### Create a role - -```bash -gcli role create --role admin -``` +`gcli role details --role ` +: Display the details about a role. -#### Delete a role +`gcli role details --role --audit` +: Show a roles's audit information -```bash -gcli role delete --role admin -``` +`gcli role list` +: List all roles. -#### Add a role to a user +`gcli role delete --role ` +: Delete a role. -```bash -gcli user grant --user new_user --role admin -``` +`gcli user grant --user --role ` +: Grant a specified role to the specified user. -#### Remove a role from a user +`gcli user revoke --user --role ` +: Revoke a role from a user. -```bash -gcli user revoke --user new_user --role admin -``` +`gcli group grant --group --role ` +: Grant a role to a group. -#### Add a role to a group +`gcli group revoke --group --role ` +: Revoke a role from a group. -```bash -gcli group grant --group groupA --role admin -``` +`gcli role grant --name --role --privilege ...` +: Grant some privileges to a role. -#### Remove a role from a group - -```bash -gcli group revoke --group groupA --role admin -``` - -### Grant a privilege - -```bash -gcli role grant --name catalog_postgres --role admin --privilege create_table modify_table -``` - -### Revoke a privilege - -```bash -gcli role revoke --metalake metalake_demo --name catalog_postgres --role admin --privilege create_table modify_table -``` +`gcli role revoke --metalake --name --role --privilege ...` +: Revoke some privileges from a role. ### Topic commands -#### Display a topic's details - -```bash -gcli topic details --name kafka.default.topic3 -``` - -#### Create a topic - -```bash -gcli topic create --name kafka.default.topic3 -``` - -#### List all topics - -```bash -gcli topic list --name kafka.default -``` - -#### Delete a topic - -```bash -gcli topic delete --name kafka.default.topic3 -``` +The name of a topic is in the format `..`. +For Kafka, the `` is always `default`. -#### Change a topic's comment +`gcli topic create --name ` +: Create a topic. -```bash -gcli topic update --name kafka.default.topic3 --comment new_comment -``` +`gcli topic details --name ` +: Display the details for a topic. -#### Display a topics's properties +`gcli topic list --name ` +: List all topics under the specified schema. -```bash -gcli topic properties --name kafka.default.topic3 -``` +`gcli topic delete --name ` +: Delete the specified topic. -#### Set a topics's property +`gcli topic update --name --comment ""` +: Change the comment for a topic. -```bash -gcli topic set --name kafka.default.topic3 --property test --value value -``` +`gcli topic properties --name ` +: List the properties for a topic -#### Remove a topics's property +`gcli topic set --name --property --value ` +: Add a property to the specified topic. -```bash -gcli topic remove --name kafka.default.topic3 --property test -``` +`gcli topic remove --name --property ` +: Remove the specified property from the specified topic. ### Fileset commands -#### Create a fileset +The name of a fileset is in the format of `..`. -```bash -gcli fileset create --name hadoop.schema.fileset --properties managed=true,location=file:/tmp/root/schema/example -``` +`gcli fileset create --name --properties ` +: Create a fileset. -#### List filesets +`gcli fileset list --name hadoop.schema` +: List filesets under the specified schema. -```bash -gcli fileset list --name hadoop.schema -``` +`gcli fileset details --name ` +: Display the details for a fileset. -#### Display a fileset's details +`gcli fileset delete --name ` +: Delete the specified fileset. -```bash -gcli fileset details --name hadoop.schema.fileset -``` +`gcli fileset update --name --comment ""` +: Change the comment for a fileset -#### Delete a fileset +`gcli fileset update --name --rename ` +: Rename an existing fileset. -```bash -gcli fileset delete --name hadoop.schema.fileset -``` - -#### Update a fileset's comment - -```bash -gcli fileset update --name hadoop.schema.fileset --comment new_comment -``` - -#### Rename a fileset - -```bash -gcli fileset update --name hadoop.schema.fileset --rename new_name -``` - -#### Display a fileset's properties +`gcli fileset properties --name ` +: List the properties for a fileset. -```bash -gcli fileset properties --name hadoop.schema.fileset -``` - -#### Set a fileset's property - -```bash -gcli fileset set --name hadoop.schema.fileset --property test --value value -``` +`gcli fileset set --name --property --value ` +: Add or update a property on a fileset. -#### Remove a fileset's property - -```bash -gcli fileset remove --name hadoop.schema.fileset --property test -``` +`gcli fileset remove --name --property ` +: Remove a property from a fileset. ### Column commands -Note that some commands are not supported depending on what the database supports. +Note that some commands are not supported on all databases. -When setting the datatype of a column the following basic types are currently supported: -null, boolean, byte, ubyte, short, ushort, integer, uinteger, long, ulong, float, double, date, time, timestamp, tztimestamp, intervalyear, intervalday, uuid, string, binary +When setting the data type of a column, the following basic types are currently supported: +`null`, `boolean`, `byte`, `ubyte`, `short`, `ushort`, `integer`, `uinteger`, `long`, `ulong`, +`float`, `double`, `date`, `time`, `timestamp`, `tztimestamp`, `intervalyear`, `intervalday`, +`uuid`, `string`, `binary`. -In addition decimal(precision,scale), fixed(length), fixedchar(length) and varchar(length). +In addition `decimal(precision,scale)`, `fixed(length)`, `fixedchar(length)` +and `varchar(length)` are supported. +The name of a column is of the format `..
.`. -#### Show all columns +`gcli column create --name --datatype long` +: Create a column. You can specify the default value using the `--default` property, + and you can specify whether the column can be null using the `--null` option. + For example: +

+ `gcli column create --name catalog_postgres.hr.departments.fullname --datatype "varchar(250)" --default "Fred Smith" --null=false` -```bash -gcli column list --name catalog_postgres.hr.departments -``` +`gcli column delete --name ` +: Delete a column. -#### Show column's audit information +`gcli column list --name
` +: List all columns for a table. -```bash -gcli column details --name catalog_postgres.hr.departments.name --audit -``` +`gcli column details --name
--audit` +: Show column's audit information -#### Show a column's audit information +`gcli column update --name --rename ` +: Rename an existing column. -```bash -gcli column details --name catalog_postgres.hr.departments.name --audit -``` +`gcli column update --name --datatype ` +: Change the data type for the specified column. -#### Add a column +`gcli column update --name --position ` +: Change the position for the specified column. -```bash -gcli column create --name catalog_postgres.hr.departments.value --datatype long -gcli column create --name catalog_postgres.hr.departments.money --datatype "decimal(10,2)" -gcli column create --name catalog_postgres.hr.departments.name --datatype "varchar(100)" -gcli column create --name catalog_postgres.hr.departments.fullname --datatype "varchar(250)" --default "Fred Smith" --null=false -``` +`gcli column update --name --null true` +: Change the nullability of the specified column. -#### Delete a column +### Authentication Support -```bash -gcli column delete --name catalog_postgres.hr.departments.money -``` +`gcli --simple` +: Authenticate using the simple authentication type. -#### Update a column +`gcli --simple --login ` +: Simple authentication with the specified user name. -```bash -gcli column update --name catalog_postgres.hr.departments.value --rename values -gcli column update --name catalog_postgres.hr.departments.values --datatype "varchar(500)" -gcli column update --name catalog_postgres.hr.departments.values --position name -gcli column update --name catalog_postgres.hr.departments.name --null true -``` - -#### Simple authentication - -```bash -gcli --simple -``` - -### Authentication - -#### Simple authentication with user name - -```bash -gcli --simple --login userName -``` \ No newline at end of file