Metadata-Version: 2.5
Name: tclake-cli
Version: 0.0.2
Summary: Command-line tool for Tencent Cloud TCLake
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# tclake-cli

Query TCLake metadata from the terminal via the `tccatalog` cloud API.
No third-party runtime dependencies; only the Python standard library is used.

## Install

Outside a virtualenv, install into your user site:

```text
python3 -m pip install --user tclake-cli
```

`~/.local/bin` must be on `PATH` (`python3 -m site --user-base` prints the prefix; the command is in its `bin` directory).

Inside a virtualenv, drop `--user`. pip refuses it there because the environment cannot see user site-packages:

```text
python3 -m pip install tclake-cli
```

The `tclake` command is then on that environment's `PATH` only while the environment is active.

## Quick start

```text
tclake init

tclake lakehouse list
tclake lakehouse list sales
tclake lakehouse list sales.db1
tclake lakehouse describe sales.db1.orders

tclake volume list
tclake volume list volc.db1
tclake volume describe volc.db1.raw
tclake volume credentials volc.db1.raw
```

`list` shows the next level below the path, `describe` shows the path itself.
`volume credentials` prints the temporary keys in clear text by design.

## JSON output

`-o json` (or `--output json`) prints the cloud API `Response` object. It can
sit before or after the subcommand. The table format stays the default.

```text
tclake lakehouse list -o json
tclake lakehouse describe sales.db1.orders --output json
tclake --output json volume credentials volc.db1.raw
```

A catalog list looks like:

```json
{
  "RequestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "CatalogNames": [
    {"Namespace": [], "Name": "lance_catalog"}
  ]
}
```

Pipe it to `jq`:

```text
tclake lakehouse list -o json | jq -r '.CatalogNames[].Name'
tclake lakehouse list sales.db1 -o json | jq -r '.TableNames[].Name'
tclake lakehouse describe sales.db1.orders -o json | jq '.Table.Columns[] | {Name, Type, Comment}'
tclake volume describe volc.db1.raw -o json | jq -r '.Volume.StorageLocation'
tclake volume credentials volc.db1.raw -o json | jq -r '.Credentials[0].CredentialInfo[] | select(.Key=="cos-access-key-id") | .Value'
```

## Credentials

`tclake init` writes `~/.tclake/config` (region, endpoint) and
`~/.tclake/credentials` (SecretId, SecretKey), both `0600`.
Environment variables override files:

```text
TENCENTCLOUD_SECRET_ID / TENCENTCLOUD_SECRET_KEY
TENCENTCLOUD_TOKEN (optional, temporary credentials)
TENCENTCLOUD_REGION / TENCENTCLOUD_ENDPOINT
```
