justinmclean commented on issue #4943:
URL: https://github.com/apache/gravitino/issues/4943#issuecomment-2351900704
## Background
Other catalogs provide a CLI to interact with the catalog’s metadata. A
Gravitino API would also be useful to be able to script Gravitino, automate
Gravitino setup, put metadata under version control, for demos or a variety of
other uses.
## Goals
- A simple wrapper around the Gravitino REST service
- Provide help on CLI use to user
- Supports listing of simple information about metalakes, catalogs, schema
and tables
- Can show simple text output or raw JSON text from REST call as an option
- Create and delete metalakes, catalogs and schema
- To be a useful simple utility
- Simple user input validation
- Simple error handling
- Debug/log option
## Not Goals
- Not to implement the full REST API
- Not to display all information about a know entity
- Initial versions assumes no authentication
## Design
The CLI would be implemented in Python using requests library for the REST
interface and click for the CLI. The command consists of options to specify the
metalake, catalog, schema etc etc, a way to specify the format and a command to
perform an action.
## Suggested Usage:
```
Usage: GravCLI.py [OPTIONS] [COMMAND]
Options:
--host TEXT Gravitino REST host and port (host:port)
--metalake TEXT Metalake name
--catalog TEXT Catalog name
--schema TEXT Schema name
--table TEXT Table name
--format TEXT "simple" or “JSON"
--help Show this message and exit.
```
Optionally consider having the commands as options i.e add –list –details
–delete –create instead of using a command.
## Commands
- Details (default) displays details about the specified entity.
- List displays details about the children of a specified entity. e.g. list
all often tables in a catalog.
- Delete deletes an entity.
- Create creates an entity. Extra options than those listed above will be
needed for this based on each entity.
**Example Usage**
List info about a metalake:
`python3 GravCLI.py --metalake metalake_demo`
List info about tables:
`python3 GravCLI.py --metalake metalake_demo --catalog catalog_mysql
--schema demo_llamaindex --table city_stats list`
List info about a metalake’s catalogs:
`python3 GravCLI.py --metalake metalake_demo list`
Create info a new metalake:
`python3 GravCLI.py --metalake metalake_new –comment “a new metalake”
create`
Delete a metalake:
`python3 GravCLI.py --metalake metalake_demo delete`
Note command can come first and doesn’t have to be at the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]