dremio-cli 1.6.0__tar.gz → 1.7.0__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.
- {dremio_cli-1.6.0/dremio_cli.egg-info → dremio_cli-1.7.0}/PKG-INFO +2 -1
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/README.md +1 -0
- dremio_cli-1.7.0/docs/profiles.md +139 -0
- dremio_cli-1.7.0/docs/tui.md +44 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/cli.py +2 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/auth.py +6 -1
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/software.py +5 -0
- dremio_cli-1.7.0/dremio_cli/commands/ui.py +20 -0
- dremio_cli-1.7.0/dremio_cli/tui/catalog/__init__.py +1 -0
- dremio_cli-1.7.0/dremio_cli/tui/catalog/app.py +34 -0
- dremio_cli-1.7.0/dremio_cli/tui/catalog/screens.py +117 -0
- dremio_cli-1.7.0/dremio_cli/tui/catalog/widgets.py +180 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0/dremio_cli.egg-info}/PKG-INFO +2 -1
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli.egg-info/SOURCES.txt +6 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/pyproject.toml +1 -1
- dremio_cli-1.6.0/docs/profiles.md +0 -378
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/LICENSE +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/MANIFEST.in +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/completions/dremio-completion.bash +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/completions/dremio-completion.zsh +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/README.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/advanced-features.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/catalog.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/completion.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/dac.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/favorites.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/grants.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/history.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/init.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/installation.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/jobs.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/lineage.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/monitor.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/quickstart.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/reflections.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/repl.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/roles.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/scripts.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/sources.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/spaces-folders.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/sql.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/tables.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/tags-wiki.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/users.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/docs/views.md +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/__main__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/base.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/cloud.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/client/factory.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/catalog.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/completion.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/favorite.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/folder.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/grant.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/history.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/init.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/job.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/lineage.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/monitor.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/profile.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/reflection.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/repl.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/role.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/script.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/source.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/space.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/sql.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/sync.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/table.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/tag.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/udf.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/user.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/view.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/commands/wiki.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/config.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/dac/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/dac/config.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/dac/diff.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/dac/state.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/dac/sync.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/env.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/formatters/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/formatters/json.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/formatters/table.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/formatters/yaml.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/history.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/utils/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/utils/console.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/utils/exceptions.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/utils/helpers.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli/utils/validators.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli.egg-info/dependency_links.txt +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli.egg-info/entry_points.txt +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli.egg-info/requires.txt +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/dremio_cli.egg-info/top_level.txt +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/setup.cfg +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/setup.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/__init__.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/conftest.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_config.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_grant_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_history_favorite.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_integration.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_job_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_multi_sql_execution.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_reflection_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_role_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_script_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_source_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_space_folder_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_sql_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_table_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_tag_wiki_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_user_commands.py +0 -0
- {dremio_cli-1.6.0 → dremio_cli-1.7.0}/tests/test_view_commands.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dremio-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: A comprehensive command-line interface for Dremio Cloud and Dremio Software
|
|
5
5
|
Home-page: https://github.com/your-org/dremio-cli
|
|
6
6
|
Author: Your Name
|
|
@@ -125,6 +125,7 @@ dremio view create --path "Analytics.summary" \
|
|
|
125
125
|
- **[History](docs/history.md)** - View and re-run commands
|
|
126
126
|
- **[REPL](docs/repl.md)** - Interactive SQL Shell (Enhanced)
|
|
127
127
|
- **[Monitor](docs/monitor.md)** - Real-time System Monitor
|
|
128
|
+
- **[Catalog Explorer](docs/tui.md)** - Interactive Catalog TUI
|
|
128
129
|
- **[Init](docs/init.md)** - Interactive Configuration Wizard
|
|
129
130
|
- **[Completion](docs/completion.md)** - Shell Completion Scripts
|
|
130
131
|
- **[Lineage](docs/lineage.md)** - Visualize dataset dependencies
|
|
@@ -72,6 +72,7 @@ dremio view create --path "Analytics.summary" \
|
|
|
72
72
|
- **[History](docs/history.md)** - View and re-run commands
|
|
73
73
|
- **[REPL](docs/repl.md)** - Interactive SQL Shell (Enhanced)
|
|
74
74
|
- **[Monitor](docs/monitor.md)** - Real-time System Monitor
|
|
75
|
+
- **[Catalog Explorer](docs/tui.md)** - Interactive Catalog TUI
|
|
75
76
|
- **[Init](docs/init.md)** - Interactive Configuration Wizard
|
|
76
77
|
- **[Completion](docs/completion.md)** - Shell Completion Scripts
|
|
77
78
|
- **[Lineage](docs/lineage.md)** - Visualize dataset dependencies
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Profile Management Guide
|
|
2
|
+
|
|
3
|
+
This guide covers how to create and manage Dremio CLI profiles using both YAML configuration files and environment variables.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Profiles store connection information for Dremio instances. The CLI supports two methods:
|
|
8
|
+
|
|
9
|
+
1. **YAML Configuration** - Stored in `~/.dremio/profiles.yaml` (RECOMMENDED for local use)
|
|
10
|
+
2. **Environment Variables** - Loaded from `.env` file or shell environment (RECOMMENDED for CI/CD)
|
|
11
|
+
|
|
12
|
+
Environment variables take precedence over YAML profiles.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🚀 Profile Values Guide
|
|
17
|
+
|
|
18
|
+
### 1. Base URL
|
|
19
|
+
The URL to your Dremio instance's API.
|
|
20
|
+
|
|
21
|
+
| Platform | Format | Example | Note |
|
|
22
|
+
|----------|--------|---------|------|
|
|
23
|
+
| **Dremio Cloud** | `https://api.dremio.cloud/v0` | `https://api.dremio.cloud/v0` | Used for US control plane |
|
|
24
|
+
| **Dremio Cloud (EU)** | `https://api.dremio.eu/v0` | `https://api.dremio.eu/v0` | Used for EU control plane |
|
|
25
|
+
| **Dremio Software** | `http(s)://<host>:<port>` | `https://dremio.company.com` | **Smart URL**: The CLI automatically appends `/api/v3` if you omit it. |
|
|
26
|
+
| **Local Software** | `http://localhost:9047` | `http://localhost:9047` | Defaults for local Docker/install |
|
|
27
|
+
|
|
28
|
+
> **Note:** For Dremio Software, you can provide `https://dremio.company.com` OR `https://dremio.company.com/api/v3`. The CLI handles both correctly.
|
|
29
|
+
|
|
30
|
+
### 2. Authentication
|
|
31
|
+
How you log in to Dremio.
|
|
32
|
+
|
|
33
|
+
| Type | Platform | Description |
|
|
34
|
+
|------|----------|-------------|
|
|
35
|
+
| **PAT** (Token) | Cloud & Software | **Recommended**. Personal Access Token generated in User Settings. |
|
|
36
|
+
| **Services Account** | Cloud Only | Treats Client/Secret as a PAT for automation. |
|
|
37
|
+
| **Username/Password** | Software Only | Traditional login. **Less secure** than PAT. |
|
|
38
|
+
|
|
39
|
+
### 3. Project ID (Cloud Only)
|
|
40
|
+
Can be found in the URL of your Dremio Cloud project.
|
|
41
|
+
- URL: `https://app.dremio.cloud/projectId/12345-abcde.../home`
|
|
42
|
+
- Project ID: `12345-abcde...`
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## YAML Configuration
|
|
47
|
+
|
|
48
|
+
**Location**: `~/.dremio/profiles.yaml`
|
|
49
|
+
|
|
50
|
+
### Examples
|
|
51
|
+
|
|
52
|
+
**Dremio Cloud (US)**
|
|
53
|
+
```yaml
|
|
54
|
+
profiles:
|
|
55
|
+
cloud-prod:
|
|
56
|
+
type: cloud
|
|
57
|
+
base_url: https://api.dremio.cloud/v0
|
|
58
|
+
project_id: 788baab4-3c3b-42da-9f1d-5cc6dc03147d
|
|
59
|
+
auth:
|
|
60
|
+
type: pat
|
|
61
|
+
token: your-personal-access-token
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Dremio Software (Corporate)**
|
|
65
|
+
```yaml
|
|
66
|
+
profiles:
|
|
67
|
+
corp-dremio:
|
|
68
|
+
type: software
|
|
69
|
+
base_url: https://dremio.corp.com # CLI will add /api/v3 automatically
|
|
70
|
+
auth:
|
|
71
|
+
type: pat
|
|
72
|
+
token: your-personal-access-token
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Dremio Software (Local/Docker)**
|
|
76
|
+
```yaml
|
|
77
|
+
profiles:
|
|
78
|
+
local:
|
|
79
|
+
type: software
|
|
80
|
+
base_url: http://localhost:9047 # Default port
|
|
81
|
+
auth:
|
|
82
|
+
type: username_password
|
|
83
|
+
username: admin
|
|
84
|
+
password: password123
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### CLI Commands
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Interactve Wizard (Best for beginners)
|
|
91
|
+
dremio init
|
|
92
|
+
|
|
93
|
+
# Create manually
|
|
94
|
+
dremio profile create --name prod --type cloud ...
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Environment Variable Configuration
|
|
100
|
+
|
|
101
|
+
Ideal for CI/CD pipelines or Docker containers.
|
|
102
|
+
|
|
103
|
+
### Pattern
|
|
104
|
+
`DREMIO_{PROFILE_NAME}_KEY=VALUE`
|
|
105
|
+
|
|
106
|
+
### Example `.env` File
|
|
107
|
+
```bash
|
|
108
|
+
# Cloud Profile (Name: 'CLOUD')
|
|
109
|
+
DREMIO_CLOUD_TYPE=cloud
|
|
110
|
+
DREMIO_CLOUD_BASE_URL=https://api.dremio.cloud/v0
|
|
111
|
+
DREMIO_CLOUD_PROJECTID=788baab4-3c3b-42da-9f1d-5cc6dc03147d
|
|
112
|
+
DREMIO_CLOUD_TOKEN=s3JcLOqFTR...
|
|
113
|
+
|
|
114
|
+
# Software Profile (Name: 'PROD')
|
|
115
|
+
DREMIO_PROD_TYPE=software
|
|
116
|
+
DREMIO_PROD_BASE_URL=https://dremio.corp.com
|
|
117
|
+
DREMIO_PROD_TOKEN=Q/ToosxORA...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Usage
|
|
121
|
+
```bash
|
|
122
|
+
# Authenticates using DREMIO_PROD_* variables
|
|
123
|
+
dremio --profile prod catalog list
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Profile Management
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# List all profiles
|
|
132
|
+
dremio profile list
|
|
133
|
+
|
|
134
|
+
# Show active profile details
|
|
135
|
+
dremio profile current
|
|
136
|
+
|
|
137
|
+
# Set default profile (so you don't need --profile flag)
|
|
138
|
+
dremio profile set-default cloud-prod
|
|
139
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Catalog Explorer (TUI)
|
|
2
|
+
|
|
3
|
+
The Dremio CLI includes an interactive Terminal User Interface (TUI) for exploring your Dremio catalog, viewing schemas, and previewing data without leaving the command line.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
dremio ui catalog
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or using a specific profile:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
dremio --profile prod ui catalog
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
### 1. Interactive Navigation
|
|
20
|
+
- **Tree View**: Navigate seamlessly through Spaces, Sources, Folders, and your Home directory.
|
|
21
|
+
- **Async Loading**: Large catalogs load quickly as you expand nodes.
|
|
22
|
+
|
|
23
|
+
### 2. Dataset Details
|
|
24
|
+
Select any dataset (View/Table) to see:
|
|
25
|
+
- **Info**: Metadata, ID, and Type.
|
|
26
|
+
- **Schema**: Column names and types.
|
|
27
|
+
- **SQL**: The underlying SQL definition (for Views).
|
|
28
|
+
|
|
29
|
+
### 3. Data Preview
|
|
30
|
+
- Switch to the **Preview** tab to instantly run a query (`SELECT * ... LIMIT 20`) and view actual data samples in a table.
|
|
31
|
+
|
|
32
|
+
## Controls
|
|
33
|
+
|
|
34
|
+
| Key | Action |
|
|
35
|
+
|-----|--------|
|
|
36
|
+
| `↑` / `↓` | Navigate Tree |
|
|
37
|
+
| `Space` | Expand/Collapse Folder |
|
|
38
|
+
| `Enter` | Select Item |
|
|
39
|
+
| `Click` | Select tabs (Info, Schema, Preview) |
|
|
40
|
+
| `q` | Quit |
|
|
41
|
+
|
|
42
|
+
## Requirements
|
|
43
|
+
- Dremio Software or Dremio Cloud
|
|
44
|
+
- Terminal with UTF-8 support
|
|
@@ -32,6 +32,7 @@ from dremio_cli.commands import (
|
|
|
32
32
|
completion,
|
|
33
33
|
lineage,
|
|
34
34
|
sync,
|
|
35
|
+
ui,
|
|
35
36
|
)
|
|
36
37
|
|
|
37
38
|
|
|
@@ -106,6 +107,7 @@ cli.add_command(monitor.monitor_command)
|
|
|
106
107
|
cli.add_command(completion.completion_command)
|
|
107
108
|
cli.add_command(lineage.lineage)
|
|
108
109
|
cli.add_command(sync.sync)
|
|
110
|
+
cli.add_command(ui.ui)
|
|
109
111
|
|
|
110
112
|
|
|
111
113
|
|
|
@@ -25,7 +25,12 @@ def authenticate_with_username_password(
|
|
|
25
25
|
AuthenticationError: If authentication fails
|
|
26
26
|
"""
|
|
27
27
|
# Use v2 API for login
|
|
28
|
-
|
|
28
|
+
# Normalize base_url to get root
|
|
29
|
+
root_url = base_url.rstrip("/")
|
|
30
|
+
if root_url.endswith("/api/v3"):
|
|
31
|
+
root_url = root_url[:-7] # remove /api/v3
|
|
32
|
+
|
|
33
|
+
login_url = f"{root_url}/apiv2/login"
|
|
29
34
|
|
|
30
35
|
try:
|
|
31
36
|
response = requests.post(
|
|
@@ -21,6 +21,11 @@ class SoftwareClient(BaseClient):
|
|
|
21
21
|
token: Authentication token
|
|
22
22
|
timeout: Request timeout in seconds
|
|
23
23
|
"""
|
|
24
|
+
# Auto-append /api/v3 if missing
|
|
25
|
+
base_url = base_url.rstrip("/")
|
|
26
|
+
if not base_url.endswith("/api/v3"):
|
|
27
|
+
base_url = f"{base_url}/api/v3"
|
|
28
|
+
|
|
24
29
|
super().__init__(base_url, token, timeout)
|
|
25
30
|
|
|
26
31
|
# Catalog operations
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import click
|
|
3
|
+
from dremio_cli.config import ProfileManager
|
|
4
|
+
from dremio_cli.tui.catalog.app import CatalogApp
|
|
5
|
+
|
|
6
|
+
@click.group("ui")
|
|
7
|
+
def ui():
|
|
8
|
+
"""Interactive TUI commands."""
|
|
9
|
+
pass
|
|
10
|
+
|
|
11
|
+
@ui.command("catalog")
|
|
12
|
+
@click.pass_context
|
|
13
|
+
def catalog_ui(ctx):
|
|
14
|
+
"""Launch interactive Catalog Explorer."""
|
|
15
|
+
client = ctx.obj.client
|
|
16
|
+
manager = ProfileManager()
|
|
17
|
+
profile = manager.get_default_profile() or "default"
|
|
18
|
+
|
|
19
|
+
app = CatalogApp(client=client, profile_name=profile)
|
|
20
|
+
app.run()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""TUI Catalog Explorer package."""
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
from textual.app import App, ComposeResult
|
|
3
|
+
from textual.widgets import Header, Footer
|
|
4
|
+
from textual.binding import Binding
|
|
5
|
+
from dremio_cli.tui.catalog.screens import CatalogScreen
|
|
6
|
+
|
|
7
|
+
class CatalogApp(App):
|
|
8
|
+
"""Dremio Catalog Explorer TUI Application."""
|
|
9
|
+
|
|
10
|
+
CSS = """
|
|
11
|
+
Screen {
|
|
12
|
+
layout: horizontal;
|
|
13
|
+
}
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
BINDINGS = [
|
|
17
|
+
Binding("q", "quit", "Quit"),
|
|
18
|
+
Binding("r", "refresh", "Refresh"),
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def __init__(self, client, profile_name: str, **kwargs):
|
|
22
|
+
super().__init__(**kwargs)
|
|
23
|
+
self.client = client
|
|
24
|
+
self.profile_name = profile_name
|
|
25
|
+
|
|
26
|
+
def compose(self) -> ComposeResult:
|
|
27
|
+
yield Header()
|
|
28
|
+
yield CatalogScreen()
|
|
29
|
+
yield Footer()
|
|
30
|
+
|
|
31
|
+
def action_refresh(self) -> None:
|
|
32
|
+
"""Refresh the catalog tree."""
|
|
33
|
+
# TODO: Implement refresh
|
|
34
|
+
self.query_one("CatalogScreen").refresh_catalog()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
from textual.app import ComposeResult
|
|
3
|
+
from textual.screen import Screen
|
|
4
|
+
from textual.widgets import Label, TabbedContent
|
|
5
|
+
from textual.containers import Vertical
|
|
6
|
+
from textual import work
|
|
7
|
+
from dremio_cli.tui.catalog.widgets import CatalogTree, DetailPane
|
|
8
|
+
import json # for debug
|
|
9
|
+
|
|
10
|
+
class CatalogScreen(Screen):
|
|
11
|
+
"""Main screen for Catalog Explorer."""
|
|
12
|
+
|
|
13
|
+
CSS = """
|
|
14
|
+
#sidebar {
|
|
15
|
+
width: 30%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
border-right: solid green;
|
|
18
|
+
}
|
|
19
|
+
#main-content {
|
|
20
|
+
width: 70%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def compose(self) -> ComposeResult:
|
|
26
|
+
yield Vertical(
|
|
27
|
+
Label("Catalog Browser", id="tree-label"),
|
|
28
|
+
CatalogTree(self.app.client),
|
|
29
|
+
id="sidebar"
|
|
30
|
+
)
|
|
31
|
+
yield Vertical(
|
|
32
|
+
DetailPane(id="details"),
|
|
33
|
+
id="main-content"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
async def on_tree_node_selected(self, event: CatalogTree.NodeSelected) -> None:
|
|
37
|
+
"""Handle tree selection."""
|
|
38
|
+
item = event.node.data
|
|
39
|
+
if not item: return
|
|
40
|
+
|
|
41
|
+
pane = self.query_one(DetailPane)
|
|
42
|
+
pane.clear()
|
|
43
|
+
pane.update_info(item)
|
|
44
|
+
|
|
45
|
+
# Determine if we should fetch more details (Schema/SQL)
|
|
46
|
+
# Only for datasets
|
|
47
|
+
itype = item.get("type", "")
|
|
48
|
+
# Handle various API type strings
|
|
49
|
+
valid_types = ["DATASET", "VIRTUAL_DATASET", "PHYSICAL_DATASET", "VIEW", "TABLE"]
|
|
50
|
+
if itype in valid_types:
|
|
51
|
+
self.fetch_dataset_details(item.get("id"))
|
|
52
|
+
|
|
53
|
+
@work(thread=True)
|
|
54
|
+
def fetch_dataset_details(self, dataset_id: str) -> None:
|
|
55
|
+
"""Fetch details for a dataset."""
|
|
56
|
+
try:
|
|
57
|
+
client = self.app.client
|
|
58
|
+
# Get full catalog item
|
|
59
|
+
details = client.get_catalog_item(dataset_id)
|
|
60
|
+
|
|
61
|
+
pane = self.query_one(DetailPane)
|
|
62
|
+
|
|
63
|
+
# Update Info
|
|
64
|
+
self.app.call_from_thread(pane.update_info, details, details)
|
|
65
|
+
|
|
66
|
+
# Update SQL
|
|
67
|
+
sql = details.get("sql")
|
|
68
|
+
self.app.call_from_thread(pane.update_sql, sql)
|
|
69
|
+
|
|
70
|
+
# Update Schema
|
|
71
|
+
fields = details.get("fields", [])
|
|
72
|
+
self.app.call_from_thread(pane.update_schema, fields)
|
|
73
|
+
|
|
74
|
+
except Exception as e:
|
|
75
|
+
self.app.notify(f"Error fetching details: {e}", severity="error")
|
|
76
|
+
|
|
77
|
+
async def on_tabbed_content_tab_activated(self, event: TabbedContent.TabActivated) -> None:
|
|
78
|
+
"""Handle tab switch."""
|
|
79
|
+
if event.tab.id == "preview":
|
|
80
|
+
# Check selected node
|
|
81
|
+
tree = self.query_one(CatalogTree)
|
|
82
|
+
if not tree.cursor_node or not tree.cursor_node.data:
|
|
83
|
+
return
|
|
84
|
+
|
|
85
|
+
item = tree.cursor_node.data
|
|
86
|
+
itype = item.get("type", "")
|
|
87
|
+
|
|
88
|
+
valid_types = ["DATASET", "VIRTUAL_DATASET", "PHYSICAL_DATASET", "VIEW", "TABLE"]
|
|
89
|
+
if itype in valid_types:
|
|
90
|
+
self.fetch_preview(item)
|
|
91
|
+
|
|
92
|
+
@work(thread=True)
|
|
93
|
+
def fetch_preview(self, item: dict) -> None:
|
|
94
|
+
"""Fetch preview data."""
|
|
95
|
+
path = ".".join(item.get("path", []))
|
|
96
|
+
try:
|
|
97
|
+
client = self.app.client
|
|
98
|
+
# Run query with quotes around path for safety
|
|
99
|
+
query_path = ".".join([f'"{p}"' for p in item.get("path", [])])
|
|
100
|
+
res = client.execute_sql(f'SELECT * FROM {query_path} LIMIT 20')
|
|
101
|
+
|
|
102
|
+
# API result format check: usually returns {'rows': [...], 'schema': [...]}
|
|
103
|
+
rows = res.get("rows", [])
|
|
104
|
+
|
|
105
|
+
columns = []
|
|
106
|
+
if rows:
|
|
107
|
+
columns = list(rows[0].keys())
|
|
108
|
+
elif "schema" in res:
|
|
109
|
+
columns = [f.get("name") for f in res.get("schema", [])]
|
|
110
|
+
|
|
111
|
+
if not columns:
|
|
112
|
+
columns = ["Result"]
|
|
113
|
+
|
|
114
|
+
pane = self.query_one(DetailPane)
|
|
115
|
+
self.app.call_from_thread(pane.update_preview, rows, columns)
|
|
116
|
+
except Exception as e:
|
|
117
|
+
self.app.notify(f"Preview failed: {e}", severity="error")
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
|
|
2
|
+
from textual.widgets import Tree, TabbedContent, TabPane, Markdown, DataTable, Static
|
|
3
|
+
from textual.widgets.tree import TreeNode
|
|
4
|
+
from textual import work
|
|
5
|
+
from rich.text import Text
|
|
6
|
+
|
|
7
|
+
class CatalogTree(Tree):
|
|
8
|
+
"""Tree widget for Dremio Catalog."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, client):
|
|
11
|
+
super().__init__("Dremio Catalog")
|
|
12
|
+
self.client = client
|
|
13
|
+
self.root.expand()
|
|
14
|
+
|
|
15
|
+
def on_mount(self) -> None:
|
|
16
|
+
"""Load initial root items."""
|
|
17
|
+
self.load_roots()
|
|
18
|
+
|
|
19
|
+
@work(thread=True)
|
|
20
|
+
def load_roots(self) -> None:
|
|
21
|
+
"""Fetch root catalog items."""
|
|
22
|
+
try:
|
|
23
|
+
# Get catalog roots
|
|
24
|
+
catalog = self.client.get_catalog()
|
|
25
|
+
data = catalog.get("data", [])
|
|
26
|
+
|
|
27
|
+
for item in data:
|
|
28
|
+
# Determine icon/color
|
|
29
|
+
itype = item.get("type", "UNKNOWN")
|
|
30
|
+
icon = "📁"
|
|
31
|
+
if itype == "SOURCE": icon = "🔌"
|
|
32
|
+
elif itype == "SPACE": icon = "🪐"
|
|
33
|
+
elif itype == "HOME": icon = "🏠"
|
|
34
|
+
elif itype == "CONTAINER":
|
|
35
|
+
# Could be anything, try to infer or just use generic
|
|
36
|
+
icon = "📦"
|
|
37
|
+
|
|
38
|
+
label = Text(f"{icon} {item.get('path', ['?'])[-1]}")
|
|
39
|
+
|
|
40
|
+
# Add node
|
|
41
|
+
node = self.root.add(label, data=item, expand=False)
|
|
42
|
+
# Add dummy child to allow expansion if it's a container
|
|
43
|
+
if itype in ["SOURCE", "SPACE", "HOME", "FOLDER", "CONTAINER"]:
|
|
44
|
+
node.allow_expand = True
|
|
45
|
+
node.add("Loading...", data=None)
|
|
46
|
+
|
|
47
|
+
except Exception as e:
|
|
48
|
+
self.notify(f"Error loading catalog: {e}", severity="error")
|
|
49
|
+
|
|
50
|
+
async def on_tree_node_expanded(self, event: Tree.NodeExpanded) -> None:
|
|
51
|
+
"""Load children when node expanded."""
|
|
52
|
+
node = event.node
|
|
53
|
+
if node.data is None: return # Root or dummy
|
|
54
|
+
|
|
55
|
+
# If we have a dummy child "Loading...", let's fetch real children
|
|
56
|
+
if len(node.children) == 1 and node.children[0].label == "Loading...":
|
|
57
|
+
self.load_children(node)
|
|
58
|
+
|
|
59
|
+
@work(thread=True)
|
|
60
|
+
def load_children(self, node: TreeNode) -> None:
|
|
61
|
+
"""Fetch children for a node."""
|
|
62
|
+
item = node.data
|
|
63
|
+
item_id = item.get("id")
|
|
64
|
+
|
|
65
|
+
if not item_id: return
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
# We need to remove the dummy node first - but safely
|
|
69
|
+
# Since we are in a thread, we should schedule UI update
|
|
70
|
+
self.app.call_from_thread(node.remove_children)
|
|
71
|
+
|
|
72
|
+
# Fetch children
|
|
73
|
+
# catalog/{id} usually returns children for containers
|
|
74
|
+
details = self.client.get_catalog_item(item_id)
|
|
75
|
+
children = details.get("children", [])
|
|
76
|
+
|
|
77
|
+
if not children:
|
|
78
|
+
self.app.call_from_thread(node.add, "-(Empty)-", data=None)
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
for child in children:
|
|
82
|
+
ctype = child.get("type", "UNKNOWN")
|
|
83
|
+
name = child.get("path", ["?"])[-1]
|
|
84
|
+
|
|
85
|
+
icon = "📄" # Dataset default
|
|
86
|
+
allow_expand = False
|
|
87
|
+
|
|
88
|
+
if ctype == "FOLDER":
|
|
89
|
+
icon = "📁"
|
|
90
|
+
allow_expand = True
|
|
91
|
+
elif ctype == "DATASET" or ctype == "VIRTUAL_DATASET" or ctype == "PHYSICAL_DATASET":
|
|
92
|
+
icon = "📊"
|
|
93
|
+
elif ctype == "FILE":
|
|
94
|
+
icon = "📑"
|
|
95
|
+
|
|
96
|
+
label = Text(f"{icon} {name}")
|
|
97
|
+
|
|
98
|
+
# Add via main thread
|
|
99
|
+
new_node = self.app.call_from_thread(node.add, label, data=child, allow_expand=allow_expand)
|
|
100
|
+
|
|
101
|
+
if allow_expand:
|
|
102
|
+
self.app.call_from_thread(new_node.add, "Loading...", data=None)
|
|
103
|
+
|
|
104
|
+
except Exception as e:
|
|
105
|
+
self.app.notify(f"Error loading children: {e}", severity="error")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
class DetailPane(Static):
|
|
109
|
+
"""Pane for showing details of selected catalog item."""
|
|
110
|
+
|
|
111
|
+
def compose(self):
|
|
112
|
+
with TabbedContent(initial="info"):
|
|
113
|
+
with TabPane("Info", id="info"):
|
|
114
|
+
yield Markdown("# Select an item", id="info-md")
|
|
115
|
+
with TabPane("Schema", id="schema"):
|
|
116
|
+
yield DataTable(id="schema-table")
|
|
117
|
+
with TabPane("SQL", id="sql"):
|
|
118
|
+
yield Static("", id="sql-view")
|
|
119
|
+
with TabPane("Preview", id="preview"):
|
|
120
|
+
yield DataTable(id="preview-table")
|
|
121
|
+
|
|
122
|
+
def on_mount(self):
|
|
123
|
+
# Setup tables
|
|
124
|
+
schema_table = self.query_one("#schema-table", DataTable)
|
|
125
|
+
schema_table.add_columns("Name", "Type")
|
|
126
|
+
|
|
127
|
+
preview_table = self.query_one("#preview-table", DataTable)
|
|
128
|
+
preview_table.cursor_type = "row"
|
|
129
|
+
|
|
130
|
+
def update_info(self, item_data: dict, full_details: dict = None):
|
|
131
|
+
"""Update info tab."""
|
|
132
|
+
path = ".".join(item_data.get("path", []))
|
|
133
|
+
itype = item_data.get("entityType", "UNKNOWN")
|
|
134
|
+
iid = item_data.get("id", "N/A")
|
|
135
|
+
|
|
136
|
+
md = f"""
|
|
137
|
+
# {path}
|
|
138
|
+
**Type**: {itype}
|
|
139
|
+
**ID**: {iid}
|
|
140
|
+
"""
|
|
141
|
+
if full_details:
|
|
142
|
+
if "createdAt" in full_details:
|
|
143
|
+
md += f"\n**Created**: {full_details.get('createdAt')}"
|
|
144
|
+
if "owner" in full_details:
|
|
145
|
+
md += f"\n**Owner**: {full_details.get('owner')}"
|
|
146
|
+
|
|
147
|
+
self.query_one("#info-md", Markdown).update(md)
|
|
148
|
+
|
|
149
|
+
def update_sql(self, sql: str):
|
|
150
|
+
self.query_one("#sql-view", Static).update(sql or "-- No SQL --")
|
|
151
|
+
|
|
152
|
+
def update_schema(self, columns: list):
|
|
153
|
+
table = self.query_one("#schema-table", DataTable)
|
|
154
|
+
table.clear()
|
|
155
|
+
if not columns: return
|
|
156
|
+
|
|
157
|
+
for col in columns:
|
|
158
|
+
name = col.get("name", "?")
|
|
159
|
+
ctype = col.get("type", {}).get("name", "UNKNOWN")
|
|
160
|
+
table.add_row(name, ctype)
|
|
161
|
+
|
|
162
|
+
def update_preview(self, rows: list, columns: list):
|
|
163
|
+
table = self.query_one("#preview-table", DataTable)
|
|
164
|
+
table.clear(columns=True)
|
|
165
|
+
|
|
166
|
+
if not columns:
|
|
167
|
+
table.add_columns("No Data")
|
|
168
|
+
return
|
|
169
|
+
|
|
170
|
+
table.add_columns(*columns)
|
|
171
|
+
for row in rows:
|
|
172
|
+
# Row is dict usually from execute_sql result
|
|
173
|
+
row_data = [str(row.get(col, "")) for col in columns]
|
|
174
|
+
table.add_row(*row_data)
|
|
175
|
+
|
|
176
|
+
def clear(self):
|
|
177
|
+
self.query_one("#info-md", Markdown).update("# Select an item")
|
|
178
|
+
self.query_one("#schema-table", DataTable).clear()
|
|
179
|
+
self.query_one("#sql-view", Static).update("")
|
|
180
|
+
self.query_one("#preview-table", DataTable).clear(columns=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dremio-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: A comprehensive command-line interface for Dremio Cloud and Dremio Software
|
|
5
5
|
Home-page: https://github.com/your-org/dremio-cli
|
|
6
6
|
Author: Your Name
|
|
@@ -125,6 +125,7 @@ dremio view create --path "Analytics.summary" \
|
|
|
125
125
|
- **[History](docs/history.md)** - View and re-run commands
|
|
126
126
|
- **[REPL](docs/repl.md)** - Interactive SQL Shell (Enhanced)
|
|
127
127
|
- **[Monitor](docs/monitor.md)** - Real-time System Monitor
|
|
128
|
+
- **[Catalog Explorer](docs/tui.md)** - Interactive Catalog TUI
|
|
128
129
|
- **[Init](docs/init.md)** - Interactive Configuration Wizard
|
|
129
130
|
- **[Completion](docs/completion.md)** - Shell Completion Scripts
|
|
130
131
|
- **[Lineage](docs/lineage.md)** - Visualize dataset dependencies
|
|
@@ -29,6 +29,7 @@ docs/spaces-folders.md
|
|
|
29
29
|
docs/sql.md
|
|
30
30
|
docs/tables.md
|
|
31
31
|
docs/tags-wiki.md
|
|
32
|
+
docs/tui.md
|
|
32
33
|
docs/users.md
|
|
33
34
|
docs/views.md
|
|
34
35
|
dremio_cli/__init__.py
|
|
@@ -72,6 +73,7 @@ dremio_cli/commands/sync.py
|
|
|
72
73
|
dremio_cli/commands/table.py
|
|
73
74
|
dremio_cli/commands/tag.py
|
|
74
75
|
dremio_cli/commands/udf.py
|
|
76
|
+
dremio_cli/commands/ui.py
|
|
75
77
|
dremio_cli/commands/user.py
|
|
76
78
|
dremio_cli/commands/view.py
|
|
77
79
|
dremio_cli/commands/wiki.py
|
|
@@ -84,6 +86,10 @@ dremio_cli/formatters/__init__.py
|
|
|
84
86
|
dremio_cli/formatters/json.py
|
|
85
87
|
dremio_cli/formatters/table.py
|
|
86
88
|
dremio_cli/formatters/yaml.py
|
|
89
|
+
dremio_cli/tui/catalog/__init__.py
|
|
90
|
+
dremio_cli/tui/catalog/app.py
|
|
91
|
+
dremio_cli/tui/catalog/screens.py
|
|
92
|
+
dremio_cli/tui/catalog/widgets.py
|
|
87
93
|
dremio_cli/utils/__init__.py
|
|
88
94
|
dremio_cli/utils/console.py
|
|
89
95
|
dremio_cli/utils/exceptions.py
|