XiaoHongbo-Hope commented on code in PR #7358: URL: https://github.com/apache/paimon/pull/7358#discussion_r2899849537
########## docs/content/pypaimon/cli.md: ########## @@ -0,0 +1,126 @@ +--- +title: "Command Line Interface" +weight: 99 +type: docs +aliases: +- /pypaimon/cli.html +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +# Command Line Interface + +PyPaimon provides a command-line interface (CLI) for interacting with Paimon catalogs and tables. +The CLI allows you to read data from Paimon tables directly from the command line. + +## Installation + +The CLI is installed automatically when you install PyPaimon: + +```shell +pip install pypaimon +``` + +After installation, the `paimon` command will be available in your terminal. + +## Configuration + +Before using the CLI, you need to create a catalog configuration file. +By default, the CLI looks for a `paimon.yaml` file in the current directory. + +### Create Configuration File + +Create a `paimon.yaml` file with your catalog settings: + +**Filesystem Catalog:** + +```yaml +metastore: filesystem +warehouse: /path/to/warehouse +``` + +**REST Catalog:** + +```yaml +metastore: rest +uri: http://localhost:8080 +warehouse: catalog_name +``` + +## Usage + +### Basic Syntax + +```shell +paimon [OPTIONS] COMMAND [ARGS]... +``` + +### Global Options + +- `-c, --config PATH`: Path to catalog configuration file (default: `paimon.yaml`) +- `--help`: Show help message and exit + +## Commands + +### Table Read + +Read data from a Paimon table and display it in a formatted table. + +#### Basic Usage + +```shell +paimon table read DATABASE.TABLE +``` + +**Example:** + +```shell +paimon table read mydb.users +``` + +Output: +``` + id name age city + 1 Alice 25 Beijing + 2 Bob 30 Shanghai + 3 Charlie 35 Guangzhou + 4 David 28 Shenzhen + 5 Eve 32 Hangzhou +``` + +#### Limit Results + +Use the `-l` or `--limit` option to limit the number of rows displayed: Review Comment: Should we add default value 100 here (ref to code in line of cli_table). -- 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]
