thoughtleaders-cli 0.6.6__tar.gz → 0.6.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/.claude-plugin/plugin.json +1 -1
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/PKG-INFO +1 -1
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/pyproject.toml +1 -1
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/SKILL.md +10 -2
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/postgres-schema.md +2 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/__init__.py +1 -1
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/brands.py +44 -0
- thoughtleaders_cli-0.6.7/src/tl_cli/commands/schema.py +83 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/uv.lock +1 -1
- thoughtleaders_cli-0.6.6/src/tl_cli/commands/schema.py +0 -55
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/.claude-plugin/marketplace.json +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/.github/workflows/python-publish.yml +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/.gitignore +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/AGENTS.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/CLAUDE.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/LICENSE +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/README.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/agents/tl-analyst.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/commands/tl-balance.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/commands/tl-reports.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/commands/tl-sponsorships.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/commands/tl.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/docs/architecture.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/hooks/hooks.json +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/hooks/scripts/post-usage.sh +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/hooks/scripts/pre-check.sh +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/business-glossary.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/elasticsearch-schema.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/firebolt-schema.md +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/_completions.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/auth/__init__.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/auth/commands.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/auth/login.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/auth/pkce.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/auth/token_store.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/client/__init__.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/client/errors.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/client/http.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/__init__.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/ask.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/balance.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/changelog.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/channels.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/comments.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/db.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/deals.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/describe.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/doctor.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/matches.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/proposals.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/recommender.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/reports.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/setup.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/snapshots.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/sponsorships.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/uploads.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/commands/whoami.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/config.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/filters.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/hints.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/main.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/output/__init__.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/output/formatter.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/src/tl_cli/self_update.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/tests/__init__.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/tests/test_auth.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/tests/test_filters.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/tests/test_output.py +0 -0
- {thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/tests/test_sponsorships.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thoughtleaders-cli
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.7
|
|
4
4
|
Summary: ThoughtLeaders CLI — query sponsorship data, channels, brands, and intelligence
|
|
5
5
|
Project-URL: Homepage, https://thoughtleaders.io
|
|
6
6
|
Project-URL: Repository, https://github.com/ThoughtLeaders-io/thoughtleaders-cli
|
|
@@ -20,6 +20,8 @@ Decision rule:
|
|
|
20
20
|
|
|
21
21
|
Always run `tl describe show <resource>` before using a structured command, and `tl schema pg|fb|es` before writing a raw query.
|
|
22
22
|
|
|
23
|
+
**When you only need the schema of one table, you MUST call `tl schema pg <table>` (or `tl schema fb <table>`) — never the unscoped form.** The unscoped `tl schema pg` returns *every* table visible to your role, which is dozens of tables and tens of thousands of tokens; the single-table form returns only the section you need, in the same markdown layout. Reaching for the unscoped form when you already know the table name is a tokens/latency tax with zero benefit. ES has no per-table form (the index is a single document shape) — `tl schema es` is the only call there.
|
|
24
|
+
|
|
23
25
|
**Process data with shell tools, not your context window.** Don't pull large result sets into your reasoning context just to filter, sort, count, or extract a field — that wastes tokens and slows you down. Pipe `tl … --json` (or `--csv`) into `jq`, `yq`, `rg`, or `duckdb` and read only the answer back. Pick the tool by shape:
|
|
24
26
|
|
|
25
27
|
- **`jq`** — filter, project, and transform JSON. The default for `tl … --json` post-processing.
|
|
@@ -67,6 +69,7 @@ Other key concepts:
|
|
|
67
69
|
- **Comments** — notes attached to sponsorships
|
|
68
70
|
- **Adspots** — types of ads a channel carries (e.g. mention, dedicated video, product placement). Returned by `tl channels show`; each carries price/cost.
|
|
69
71
|
- **MSN** (Media Selling Network) — the ~11k YouTube channels that have opted in to receive sponsorship offers. A channels is in the MSN group if the `channel.media_selling_network_join_date` field is not null.
|
|
72
|
+
- **MBN** (Media Buying Network) — the brand-side counterpart to MSN: brand profiles that have opted in to receive proposed sponsorships. A profile is in the MBN group if the `profile.media_buying_network_join_date` field is not null.
|
|
70
73
|
- **TPP** (ThoughtLeaders Partner Program, a.k.a. "TL channels") — the smaller, exclusive ~169 channels TL manages directly. A channel is in the TPP group if the `channel.is_tl_channel` is True.
|
|
71
74
|
- **`demographics_updated_at`** (on channel detail) — ISO timestamp of when demographic screenshots were last uploaded and processed via OCR. If non-null, the channel has demographics screenshots on file. If null, no screenshots have been uploaded. Use this to check whether a channel has demographics data from screenshots.
|
|
72
75
|
- **`impression`** (on channels) — projected views per video on that channel. Forward-looking estimate. May be null when not yet computed.
|
|
@@ -112,6 +115,7 @@ The CLI exposes three different discovery surfaces — pick by what you actually
|
|
|
112
115
|
| Arguments and flags for a specific leaf command | `tl <group> <subcommand> --help` (e.g. `tl recommender top-channels --help`) |
|
|
113
116
|
| Fields, filters, credit rates for a **data resource** (sponsorships, uploads, snapshots, reports, comments, recommender) | `tl describe show <resource> --json` |
|
|
114
117
|
| The live PG/ES/Firebolt schema for raw `tl db` queries | `tl schema pg` / `tl schema es` / `tl schema fb` |
|
|
118
|
+
| The schema of a **single** PG / Firebolt table | **`tl schema pg <table>`** / **`tl schema fb <table>`** — strongly preferred when you only need one |
|
|
115
119
|
|
|
116
120
|
Notes:
|
|
117
121
|
- Use `--help` everywhere — there is no separate `tl help` command. `tl help` returns "No such command 'help'".
|
|
@@ -153,6 +157,8 @@ tl channels similar <id-or-name> # Similarity recommender (25 credits flat
|
|
|
153
157
|
tl brands show <id-or-name> # Brand detail (1 credit)
|
|
154
158
|
tl brands history <id-or-name> # Sponsorship history (5 credits/result, linear)
|
|
155
159
|
tl brands history <query> --channel <id> # Brand mentions on specific channel
|
|
160
|
+
tl brands history-stats <id-or-name> # Aggregate roll-up: counts, total/avg/median views, first/last seen, by-year, top channels (5 credits flat)
|
|
161
|
+
tl brands history-stats <q> --channel <id> # Same roll-up, narrowed to one channel
|
|
156
162
|
tl brands similar <id-or-name> # Find similar brands via similarity search (25 credits flat)
|
|
157
163
|
tl recommender tags [query] # List similarity tag names — categories, demographics, formats (free)
|
|
158
164
|
tl recommender top-channels "<tag>" # Top channels loaded on a similarity tag (25 credits; Intelligence)
|
|
@@ -317,8 +323,10 @@ If a user asks for one of the **Unavailable** items, say so explicitly and propo
|
|
|
317
323
|
```bash
|
|
318
324
|
tl describe # List all resources with credit costs (free)
|
|
319
325
|
tl describe show <resource> --json # Fields, filters, credit rates (free)
|
|
320
|
-
tl schema pg # PostgreSQL schema reference for `tl db pg` (free)
|
|
321
|
-
tl schema
|
|
326
|
+
tl schema pg # PostgreSQL schema reference for `tl db pg` (free) — every visible table
|
|
327
|
+
tl schema pg <table> # PostgreSQL schema for a SINGLE table (free) — same markdown shape
|
|
328
|
+
tl schema fb # Live Firebolt tables and column types for `tl db fb` (free) — both tables
|
|
329
|
+
tl schema fb <table> # Firebolt schema for a SINGLE table (free) — `article_metrics` or `channel_metrics`
|
|
322
330
|
tl schema es # Elasticsearch document shape for `tl db es` (free)
|
|
323
331
|
tl balance --json # Credit balance (free)
|
|
324
332
|
tl whoami # Current user, org, brands (free)
|
{thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/postgres-schema.md
RENAMED
|
@@ -27,6 +27,8 @@ The main deals table. Each row = one sponsorship deal between a brand and a YouT
|
|
|
27
27
|
> - ❌ `organization_id` — there is NO direct org FK. Org is reached via `creator_profile_id → profile.organization_id → organization`.
|
|
28
28
|
> - ❌ `channel_id` — channel is reached via `ad_spot_id → adspot.channel_id → channel`.
|
|
29
29
|
> - ❌ `youtube_id` (on channel) — use `external_channel_id`.
|
|
30
|
+
> - ❌ `msn_join_date` (on channel) — use `media_selling_network_join_date`.
|
|
31
|
+
> - ❌ `mbn_join_date` (on profile) — use `media_buying_network_join_date`.
|
|
30
32
|
|
|
31
33
|
#### Key Columns
|
|
32
34
|
|
|
@@ -118,6 +118,50 @@ def history_cmd(
|
|
|
118
118
|
client.close()
|
|
119
119
|
|
|
120
120
|
|
|
121
|
+
@app.command("history-stats")
|
|
122
|
+
def history_stats_cmd(
|
|
123
|
+
query: str = typer.Argument(..., help="Brand name or numeric ID"),
|
|
124
|
+
channel: int | None = typer.Option(None, "--channel", "-c", help="Restrict the roll-up to a specific channel"),
|
|
125
|
+
top_channels: int = typer.Option(10, "--top-channels", help="How many top-by-count channels to include in the roll-up (1-50)"),
|
|
126
|
+
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
127
|
+
csv_output: bool = typer.Option(False, "--csv", help="CSV output"),
|
|
128
|
+
md_output: bool = typer.Option(False, "--md", help="Markdown output"),
|
|
129
|
+
toon_output: bool = typer.Option(False, "--toon", help="TOON output (token-efficient for LLMs)"),
|
|
130
|
+
) -> None:
|
|
131
|
+
"""Aggregate roll-up of a brand's sponsorship history (no per-row output).
|
|
132
|
+
|
|
133
|
+
Same scope as `tl brands history` (videos where the brand is in
|
|
134
|
+
`sponsored_brand_mentions`), but returned as a single summary
|
|
135
|
+
record: total sponsored videos, view sums/avg/median, first/last
|
|
136
|
+
seen dates, per-year buckets, top channels by count, and
|
|
137
|
+
TL-brokered adlink counts. Computed via one ES aggregation +
|
|
138
|
+
one PG count — cost is flat regardless of how prolific the
|
|
139
|
+
brand is.
|
|
140
|
+
|
|
141
|
+
Requires an Intelligence plan. Costs 5 credits flat.
|
|
142
|
+
|
|
143
|
+
Examples:
|
|
144
|
+
tl brands history-stats Nike
|
|
145
|
+
tl brands history-stats 21416 --top-channels 25
|
|
146
|
+
tl brands history-stats Nike --channel 12345 --json
|
|
147
|
+
"""
|
|
148
|
+
fmt = detect_format(json_output, csv_output, md_output, toon_output)
|
|
149
|
+
|
|
150
|
+
params: dict[str, str] = {"top-channels": str(top_channels)}
|
|
151
|
+
if channel is not None:
|
|
152
|
+
params["channel_id"] = str(channel)
|
|
153
|
+
|
|
154
|
+
encoded_query = urllib.parse.quote(query, safe="")
|
|
155
|
+
client = get_client()
|
|
156
|
+
try:
|
|
157
|
+
data = client.get(f"/brands/{encoded_query}/history-stats", params=params)
|
|
158
|
+
output_single(data, fmt)
|
|
159
|
+
except ApiError as e:
|
|
160
|
+
handle_api_error(e)
|
|
161
|
+
finally:
|
|
162
|
+
client.close()
|
|
163
|
+
|
|
164
|
+
|
|
121
165
|
SIMILAR_COLUMNS = ["score", "brand_id", "brand_name", "website", "mbn"]
|
|
122
166
|
SIMILAR_COLUMN_CONFIG = {
|
|
123
167
|
"score": {"justify": "right"},
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""tl schema — Show raw-db schema documentation for `tl db pg|fb|es`."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
from rich.markdown import Markdown
|
|
8
|
+
|
|
9
|
+
from tl_cli.client.errors import ApiError, handle_api_error
|
|
10
|
+
from tl_cli.client.http import get_client
|
|
11
|
+
|
|
12
|
+
app = typer.Typer(help="Show schema documentation for raw db queries (`tl db pg|fb|es`)")
|
|
13
|
+
console = Console()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _show(db: str, json_output: bool, table: str | None = None) -> None:
|
|
17
|
+
client = get_client()
|
|
18
|
+
try:
|
|
19
|
+
params = {"table": table} if table else {}
|
|
20
|
+
data = client.get(f"/raw/{db}/schema", params=params)
|
|
21
|
+
if json_output:
|
|
22
|
+
print(json.dumps(data, indent=2, default=str))
|
|
23
|
+
return
|
|
24
|
+
content = data.get("content", "")
|
|
25
|
+
if console.is_terminal:
|
|
26
|
+
console.print(Markdown(content))
|
|
27
|
+
else:
|
|
28
|
+
print(content)
|
|
29
|
+
except ApiError as e:
|
|
30
|
+
handle_api_error(e)
|
|
31
|
+
finally:
|
|
32
|
+
client.close()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@app.command("pg")
|
|
36
|
+
def pg_cmd(
|
|
37
|
+
table: str = typer.Argument(None, help="Optional table name. When given, prints only that table's section in the same markdown format."),
|
|
38
|
+
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
39
|
+
) -> None:
|
|
40
|
+
"""Show PostgreSQL schema reference (for `tl db pg`).
|
|
41
|
+
|
|
42
|
+
With no argument: lists every table visible to your role.
|
|
43
|
+
With a table name: prints only that table's column listing.
|
|
44
|
+
|
|
45
|
+
**Strongly preferred for single-table lookups.** Listing every
|
|
46
|
+
table just to read one is wasteful — pass the table name and the
|
|
47
|
+
server returns only that section.
|
|
48
|
+
|
|
49
|
+
Examples:
|
|
50
|
+
tl schema pg
|
|
51
|
+
tl schema pg thoughtleaders_channel
|
|
52
|
+
tl schema pg thoughtleaders_adlink --json
|
|
53
|
+
"""
|
|
54
|
+
_show("pg", json_output, table=table)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@app.command("fb")
|
|
58
|
+
def fb_cmd(
|
|
59
|
+
table: str = typer.Argument(None, help="Optional table name (`article_metrics` or `channel_metrics`). When given, prints only that table's section."),
|
|
60
|
+
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
61
|
+
) -> None:
|
|
62
|
+
"""Show Firebolt schema (live: tables and column types) for `tl db fb`.
|
|
63
|
+
|
|
64
|
+
With no argument: lists both accepted tables.
|
|
65
|
+
With a table name: prints only that table's columns + primary index.
|
|
66
|
+
|
|
67
|
+
**Strongly preferred for single-table lookups.** Pass the table
|
|
68
|
+
name to skip the other one.
|
|
69
|
+
|
|
70
|
+
Examples:
|
|
71
|
+
tl schema fb
|
|
72
|
+
tl schema fb article_metrics
|
|
73
|
+
tl schema fb channel_metrics --json
|
|
74
|
+
"""
|
|
75
|
+
_show("fb", json_output, table=table)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@app.command("es")
|
|
79
|
+
def es_cmd(
|
|
80
|
+
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
81
|
+
) -> None:
|
|
82
|
+
"""Show Elasticsearch document shape for `tl db es`."""
|
|
83
|
+
_show("es", json_output)
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"""tl schema — Show raw-db schema documentation for `tl db pg|fb|es`."""
|
|
2
|
-
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
import typer
|
|
6
|
-
from rich.console import Console
|
|
7
|
-
from rich.markdown import Markdown
|
|
8
|
-
|
|
9
|
-
from tl_cli.client.errors import ApiError, handle_api_error
|
|
10
|
-
from tl_cli.client.http import get_client
|
|
11
|
-
|
|
12
|
-
app = typer.Typer(help="Show schema documentation for raw db queries (`tl db pg|fb|es`)")
|
|
13
|
-
console = Console()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def _show(db: str, json_output: bool) -> None:
|
|
17
|
-
client = get_client()
|
|
18
|
-
try:
|
|
19
|
-
data = client.get(f"/raw/{db}/schema")
|
|
20
|
-
if json_output:
|
|
21
|
-
print(json.dumps(data, indent=2, default=str))
|
|
22
|
-
return
|
|
23
|
-
content = data.get("content", "")
|
|
24
|
-
if console.is_terminal:
|
|
25
|
-
console.print(Markdown(content))
|
|
26
|
-
else:
|
|
27
|
-
print(content)
|
|
28
|
-
except ApiError as e:
|
|
29
|
-
handle_api_error(e)
|
|
30
|
-
finally:
|
|
31
|
-
client.close()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@app.command("pg")
|
|
35
|
-
def pg_cmd(
|
|
36
|
-
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
37
|
-
) -> None:
|
|
38
|
-
"""Show PostgreSQL schema reference (for `tl db pg`)."""
|
|
39
|
-
_show("pg", json_output)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@app.command("fb")
|
|
43
|
-
def fb_cmd(
|
|
44
|
-
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
45
|
-
) -> None:
|
|
46
|
-
"""Show Firebolt schema (live: tables and column types) for `tl db fb`."""
|
|
47
|
-
_show("fb", json_output)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@app.command("es")
|
|
51
|
-
def es_cmd(
|
|
52
|
-
json_output: bool = typer.Option(False, "--json", help="JSON output"),
|
|
53
|
-
) -> None:
|
|
54
|
-
"""Show Elasticsearch document shape for `tl db es`."""
|
|
55
|
-
_show("es", json_output)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/business-glossary.md
RENAMED
|
File without changes
|
{thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/elasticsearch-schema.md
RENAMED
|
File without changes
|
{thoughtleaders_cli-0.6.6 → thoughtleaders_cli-0.6.7}/skills/tl/references/firebolt-schema.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|