rdblue commented on code in PR #5672: URL: https://github.com/apache/iceberg/pull/5672#discussion_r962038544
########## docs/python-quickstart.md: ########## @@ -26,45 +26,431 @@ menu: --> -# Python API Quickstart +# Python CLI Quickstart -## Installation +Pyiceberg ships with a CLI that's available after installing the package. -Iceberg python is currently in development, for development and testing purposes the best way to install the library is to perform the following steps: +```sh +➜ pyiceberg --help +Usage: pyiceberg [OPTIONS] COMMAND [ARGS]... + +Options: + --catalog TEXT + --verbose BOOLEAN + --output [text|json] + --uri TEXT + --credential TEXT + --help Show this message and exit. + +Commands: + describe Describes a namespace xor table + drop Operations to drop a namespace or table + list Lists tables or namespaces + location Returns the location of the table + properties Properties on tables/namespaces + rename Renames a table + schema Gets the schema of the table + spec Returns the partition spec of the table + uuid Returns the UUID of the table +``` + +Browsing the catalog + +```sh +➜ pyiceberg --uri thrift://localhost:9083 list +default +nyc +``` + +```sh +➜ pyiceberg --uri thrift://localhost:9083 list nyc +nyc.taxis ``` -git clone https://github.com/apache/iceberg.git -cd iceberg/python -pip install -e . + +```sh +➜ pyiceberg --uri thrift://localhost:9083 list nyc +nyc.taxis ``` -## Testing -Testing is done using tox. The config can be found in `tox.ini` within the python directory of the iceberg project. +```sh +pyiceberg --uri thrift://localhost:9083 describe nyc.taxis +Table format version 1 +Metadata location file:/.../nyc.db/taxis/metadata/00000-aa3a3eac-ea08-4255-b890-383a64a94e42.metadata.json +Table UUID 6cdfda33-bfa3-48a7-a09e-7abb462e3460 +Last Updated 1661783158061 +Partition spec [] +Sort order [] +Current schema Schema, id=0 + ├── 1: VendorID: optional long + ├── 2: tpep_pickup_datetime: optional timestamptz + ├── 3: tpep_dropoff_datetime: optional timestamptz + ├── 4: passenger_count: optional double + ├── 5: trip_distance: optional double + ├── 6: RatecodeID: optional double + ├── 7: store_and_fwd_flag: optional string + ├── 8: PULocationID: optional long + ├── 9: DOLocationID: optional long + ├── 10: payment_type: optional long + ├── 11: fare_amount: optional double + ├── 12: extra: optional double + ├── 13: mta_tax: optional double + ├── 14: tip_amount: optional double + ├── 15: tolls_amount: optional double + ├── 16: improvement_surcharge: optional double + ├── 17: total_amount: optional double + ├── 18: congestion_surcharge: optional double + └── 19: airport_fee: optional double +Current snapshot Operation.APPEND: id=5937117119577207079, schema_id=0 +Snapshots Snapshots + └── Snapshot 5937117119577207079, schema 0: file:/.../nyc.db/taxis/metadata/snap-5937117119577207079-1-94656c4f-4c66-4600-a4ca-f30377300527.avro +Properties owner root + write.format.default parquet ``` -# simply run tox from within the python dir -tox + +Or output in JSON for automation: + +```sh +pyiceberg --uri thrift://localhost:9083 --output json describe nyc.taxis | jq +{ + "identifier": [ Review Comment: This is a bit long. Could we snip some parts of the schemas? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org