dremio-cli 1.2.0__tar.gz → 1.4.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.2.0/dremio_cli.egg-info → dremio_cli-1.4.0}/PKG-INFO +1 -1
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/README.md +47 -13
- dremio_cli-1.4.0/docs/admin.md +48 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/jobs.md +3 -1
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/profiles.md +17 -0
- dremio_cli-1.4.0/docs/reflections.md +71 -0
- dremio_cli-1.4.0/docs/scripts.md +49 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/cli.py +13 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/auth.py +10 -1
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/base.py +12 -2
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/cloud.py +151 -6
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/factory.py +10 -2
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/software.py +252 -12
- dremio_cli-1.4.0/dremio_cli/commands/engine.py +118 -0
- dremio_cli-1.4.0/dremio_cli/commands/reflection.py +167 -0
- dremio_cli-1.4.0/dremio_cli/commands/script.py +139 -0
- dremio_cli-1.4.0/dremio_cli/commands/wlm.py +119 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/env.py +7 -1
- {dremio_cli-1.2.0 → dremio_cli-1.4.0/dremio_cli.egg-info}/PKG-INFO +1 -1
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli.egg-info/SOURCES.txt +7 -2
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/pyproject.toml +1 -1
- dremio_cli-1.2.0/dremio_cli/commands/lineage.py +0 -9
- dremio_cli-1.2.0/dremio_cli/commands/udf.py +0 -9
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/LICENSE +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/MANIFEST.in +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/README.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/completions/dremio-completion.bash +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/completions/dremio-completion.zsh +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/advanced-features.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/catalog.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/grants.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/installation.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/quickstart.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/roles.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/sources.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/spaces-folders.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/sql.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/tables.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/tags-wiki.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/users.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/docs/views.md +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/__main__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/client/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/catalog.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/favorite.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/folder.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/grant.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/history.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/job.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/profile.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/role.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/source.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/space.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/sql.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/table.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/tag.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/user.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/view.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/commands/wiki.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/config.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/formatters/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/formatters/json.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/formatters/table.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/formatters/yaml.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/history.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/utils/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/utils/exceptions.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/utils/helpers.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli/utils/validators.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli.egg-info/dependency_links.txt +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli.egg-info/entry_points.txt +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli.egg-info/requires.txt +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/dremio_cli.egg-info/top_level.txt +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/setup.cfg +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/setup.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/__init__.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_config.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_grant_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_history_favorite.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_integration.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_job_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_role_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_source_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_space_folder_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_sql_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_table_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_tag_wiki_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_user_commands.py +0 -0
- {dremio_cli-1.2.0 → dremio_cli-1.4.0}/tests/test_view_commands.py +0 -0
|
@@ -23,9 +23,16 @@ Complete documentation for the Dremio Command Line Interface.
|
|
|
23
23
|
- **[Tags & Wiki](tags-wiki.md)** - Document and categorize datasets
|
|
24
24
|
- **[Grants](grants.md)** - Manage access control and permissions
|
|
25
25
|
|
|
26
|
+
### Acceleration
|
|
27
|
+
- **[Reflections](reflections.md)** - Manage data reflections
|
|
28
|
+
|
|
26
29
|
### Administration
|
|
27
30
|
- **[Users](users.md)** - User account management
|
|
28
31
|
- **[Roles](roles.md)** - Role-based access control
|
|
32
|
+
- **[Admin Controls](admin.md)** - WLM Queues & Engines
|
|
33
|
+
|
|
34
|
+
### Developer Tools
|
|
35
|
+
- **[Scripts](scripts.md)** - Manage SQL Runner scripts
|
|
29
36
|
|
|
30
37
|
## 🚀 Quick Start
|
|
31
38
|
|
|
@@ -122,23 +129,50 @@ dremio grant list <id> # List grants
|
|
|
122
129
|
dremio grant add <id> # Add grant
|
|
123
130
|
dremio user list # List users
|
|
124
131
|
dremio role list # List roles
|
|
132
|
+
dremio wlm queue list # List WLM queues
|
|
133
|
+
dremio engine list # List engines
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Acceleration
|
|
137
|
+
```bash
|
|
138
|
+
dremio reflection list # List reflections
|
|
139
|
+
dremio reflection get <id> # Get reflection
|
|
125
140
|
```
|
|
126
141
|
|
|
142
|
+
### Scripts
|
|
143
|
+
```bash
|
|
144
|
+
dremio script list # List scripts
|
|
145
|
+
dremio script create # Create script
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 🌐 Platform Support
|
|
149
|
+
|
|
127
150
|
## 🌐 Platform Support
|
|
128
151
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
|
132
|
-
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
152
|
+
The CLI is designed to work across Dremio Cloud and Dremio Software (versions 24+). It automatically handles API version differences (v2/v3) and authentication methods.
|
|
153
|
+
|
|
154
|
+
| Feature | Software (v26) | Software (v25) | Cloud | Notes |
|
|
155
|
+
|---------|:--------------:|:--------------:|:-----:|-------|
|
|
156
|
+
| **Connect / Auth** | ✅ | ✅ | ✅ | Supports PAT (Cloud/Soft) & User/Pass (Software v25/v26) |
|
|
157
|
+
| **Catalog Operations** | ✅ | ✅ | ✅ | Browse items, get details, lookup by path |
|
|
158
|
+
| **SQL Execution** | ✅ | ✅ | ✅ | Execute, wait, poll, and fetch results |
|
|
159
|
+
| **Source Management** | ✅ | ✅ | ✅ | List, get, create, delete sources |
|
|
160
|
+
| **Job Management** | ✅ | ✅ | ⚠️ | Cloud job **listing** is limited via API; SQL execution status/results work fully. |
|
|
161
|
+
| **User Management** | ✅ | ✅ | N/A | Managed via Console/SCIM on Cloud. v25/v26 use Legacy API fallback. |
|
|
162
|
+
| **Role Management** | ✅ | ✅ | N/A | Managed via Console/SCIM on Cloud. v25/v26 use Legacy API fallback. |
|
|
163
|
+
| **View/Space/Folder** | ✅ | ✅ | ✅ | Full CRUD support |
|
|
164
|
+
| **Tags & Wiki** | ✅ | ✅ | ✅ | |
|
|
165
|
+
| **Grants** | ✅ | ✅ | ✅ | |
|
|
166
|
+
| **Reflections** | ✅ | ✅ | ✅ | |
|
|
167
|
+
| **WLM (Queues)** | ✅ | ✅ | N/A | Software Only |
|
|
168
|
+
| **Engines** | ✅ | ✅ | ✅ | Replicas on Cloud |
|
|
169
|
+
| **Scripts** | ✅ | ✅ | ✅ | |
|
|
170
|
+
|
|
171
|
+
### Compatibility Notes
|
|
172
|
+
|
|
173
|
+
- **Cloud**: `job list` is currently not supported via the public API. Use the Dremio Console for job history or `sql execute` for running specific queries.
|
|
174
|
+
- **Software v25/Legacy**: The CLI supports legacy username/password authentication (via HTTP/HTTPS) and automatically falls back to the `apiv2` endpoints for listing jobs, users, and roles where `apiv3` is unavailable.
|
|
175
|
+
- **SSL**: For local development or instances with self-signed certificates, use `DREMIO_{PROFILE}_SSL=false` in your environment or `.env` file.
|
|
142
176
|
|
|
143
177
|
## 💡 Tips & Best Practices
|
|
144
178
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Administrative Controls
|
|
2
|
+
|
|
3
|
+
The CLI provides administrative capabilities for managing workloads and compute engines.
|
|
4
|
+
|
|
5
|
+
## Workload Management (WLM)
|
|
6
|
+
|
|
7
|
+
**Platform Support**: Dremio Software (v24+) Only.
|
|
8
|
+
**Note**: Dremio Cloud handles workload management automatically/differently via Engines (Replicas).
|
|
9
|
+
|
|
10
|
+
### Queues
|
|
11
|
+
|
|
12
|
+
List defined WLM queues, their CPU tiers, and concurrency limits.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
dremio wlm queue list
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Rules
|
|
19
|
+
|
|
20
|
+
List WLM routing rules.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
dremio wlm rule list
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Engine Management
|
|
27
|
+
|
|
28
|
+
View and inspect Dremio Engines (Software) or Replicas (Cloud).
|
|
29
|
+
|
|
30
|
+
**Platform Support**: Software & Cloud.
|
|
31
|
+
|
|
32
|
+
### List Engines
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
dremio engine list
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Output Differences:**
|
|
39
|
+
- **Software**: Displays Engine Name, Size (e.g., Medium, 4 executors), and Status (RUNNING, STOPPED).
|
|
40
|
+
- **Cloud**: Displays Engine Name, Size (e.g., 2X-Small), and Replica Count.
|
|
41
|
+
|
|
42
|
+
### Get Engine Details
|
|
43
|
+
|
|
44
|
+
Get detailed specification and status for a specific engine.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
dremio engine get <engine-id>
|
|
48
|
+
```
|
|
@@ -8,10 +8,12 @@ This guide covers job management operations including listing, monitoring, and m
|
|
|
8
8
|
|
|
9
9
|
List recent jobs.
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```
|
|
12
12
|
dremio job list [OPTIONS]
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
> **Note (Cloud)**: Job listing via the CLI is currently limited or unavailable on Dremio Cloud due to API restrictions. Use the Dremio Console to view full job history. SQL execution and result retrieval for specific jobs work normally.
|
|
16
|
+
|
|
15
17
|
**Options:**
|
|
16
18
|
- `--max-results INTEGER` - Maximum number of results to return
|
|
17
19
|
- `--filter TEXT` - Filter expression (e.g., `state=COMPLETED`)
|
|
@@ -106,6 +106,23 @@ DREMIO_CLOUD_PROJECTID=788baab4-3c3b-42da-9f1d-5cc6dc03147d
|
|
|
106
106
|
DREMIO_CLOUD_TOKEN=s3JcLOqFTR6qnurWp09epkXfy0+06N9i5oSwG0KbRthqmgiL1DvMgd2+LSNgUA==
|
|
107
107
|
DREMIO_CLOUD_TESTING_FOLDER=testing
|
|
108
108
|
|
|
109
|
+
### Software (PAT Auth)
|
|
110
|
+
```bash
|
|
111
|
+
DREMIO_SOFTWARE_TYPE=software
|
|
112
|
+
DREMIO_SOFTWARE_BASE_URL=https://dremio.example.com/api/v3
|
|
113
|
+
DREMIO_SOFTWARE_AUTH_TYPE=pat
|
|
114
|
+
DREMIO_SOFTWARE_TOKEN=my-secret-pat
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Software v25 / Legacy (Username/Password)
|
|
118
|
+
```bash
|
|
119
|
+
DREMIO_V25_TYPE=software
|
|
120
|
+
DREMIO_V25_BASE_URL=https://localhost:9047
|
|
121
|
+
# Note: /api/v3 is automatically appended for API calls, stripped for login
|
|
122
|
+
DREMIO_V25_AUTH_TYPE=username_password
|
|
123
|
+
DREMIO_V25_USERNAME=alex
|
|
124
|
+
DREMIO_V25_PASSWORD=password123
|
|
125
|
+
```
|
|
109
126
|
# Software Profile
|
|
110
127
|
DREMIO_SOFTWARE_TYPE=software
|
|
111
128
|
DREMIO_SOFTWARE_BASE_URL=https://v26.dremio.org/api/v3
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Reflections
|
|
2
|
+
|
|
3
|
+
Reflections are Dremio's data acceleration technology. The CLI allows you to view and manage reflections programmatically.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### List Reflections
|
|
8
|
+
|
|
9
|
+
List all reflections in the environment (Software) or Project (Cloud).
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dremio reflection list
|
|
13
|
+
dremio reflection list --output json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Get Reflection Details
|
|
17
|
+
|
|
18
|
+
Get details for a specific reflection, including its status, footprint, and definition.
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
dremio reflection get <reflection-id>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Create Reflection (Software)
|
|
25
|
+
|
|
26
|
+
Create a new reflection on a dataset. You can create `RAW` or `AGGREGATION` reflections.
|
|
27
|
+
|
|
28
|
+
**Basic Usage:**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
dremio reflection create \
|
|
32
|
+
--dataset-id <dataset-id> \
|
|
33
|
+
--name "my_reflection" \
|
|
34
|
+
--type RAW \
|
|
35
|
+
--field "my_field"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Advanced Usage (File-based):**
|
|
39
|
+
|
|
40
|
+
For complex definitions involving partition keys, sort keys, or distribution keys, define the reflection in a JSON file.
|
|
41
|
+
|
|
42
|
+
*reflection.json*:
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"name": "complex_reflection",
|
|
46
|
+
"type": "RAW",
|
|
47
|
+
"datasetId": "...",
|
|
48
|
+
"displayFields": [{"name": "field1"}, {"name": "field2"}],
|
|
49
|
+
"partitionDistributionStrategy": "STRIPED",
|
|
50
|
+
"partitionFields": [{"name": "fieldA"}]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
dremio reflection create --from-file reflection.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Delete Reflection
|
|
59
|
+
|
|
60
|
+
Remove a reflection.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
dremio reflection delete <reflection-id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Platform Support
|
|
67
|
+
|
|
68
|
+
| Feature | Software | Cloud | Notes |
|
|
69
|
+
| :--- | :---: | :---: | :--- |
|
|
70
|
+
| **List/Get** | ✅ | ✅ | Cloud listing is scoped to the active Project. |
|
|
71
|
+
| **Create/Delete** | ✅ | ✅ | Valid Dataset IDs and Field names are required. |
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Scripts (SQL Runner)
|
|
2
|
+
|
|
3
|
+
Manage SQL scripts saved in the Dremio SQL Runner. This allows you to programmatically deploy, backup, or share SQL scripts.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### List Scripts
|
|
8
|
+
|
|
9
|
+
List all saved scripts.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dremio script list
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Get Script
|
|
16
|
+
|
|
17
|
+
View the content and details of a script.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
dremio script get <script-id>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Create Script
|
|
24
|
+
|
|
25
|
+
Save a new script to the SQL Runner.
|
|
26
|
+
|
|
27
|
+
**From String:**
|
|
28
|
+
```bash
|
|
29
|
+
dremio script create --name "Daily Analysis" --content "SELECT count(*) FROM sales WHERE date = CURRENT_DATE"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**From File:**
|
|
33
|
+
```bash
|
|
34
|
+
dremio script create --name "Complex Report" --file ./reports/complex_query.sql
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Delete Script
|
|
38
|
+
|
|
39
|
+
Remove a saved script.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
dremio script delete <script-id>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Platform Support
|
|
46
|
+
|
|
47
|
+
| Feature | Software | Cloud | Notes |
|
|
48
|
+
| :--- | :---: | :---: | :--- |
|
|
49
|
+
| **All Operations** | ✅ | ✅ | Fully supported on both platforms. Cloud operations are scoped to the active Project. |
|
|
@@ -23,7 +23,12 @@ from dremio_cli.commands import (
|
|
|
23
23
|
wiki,
|
|
24
24
|
grant,
|
|
25
25
|
history,
|
|
26
|
+
history,
|
|
26
27
|
favorite,
|
|
28
|
+
reflection,
|
|
29
|
+
wlm,
|
|
30
|
+
engine,
|
|
31
|
+
script,
|
|
27
32
|
)
|
|
28
33
|
|
|
29
34
|
|
|
@@ -90,6 +95,10 @@ cli.add_command(wiki.wiki)
|
|
|
90
95
|
cli.add_command(grant.grant)
|
|
91
96
|
cli.add_command(history.history)
|
|
92
97
|
cli.add_command(favorite.favorite)
|
|
98
|
+
cli.add_command(reflection.reflection)
|
|
99
|
+
cli.add_command(wlm.wlm)
|
|
100
|
+
cli.add_command(engine.engine)
|
|
101
|
+
cli.add_command(script.script)
|
|
93
102
|
|
|
94
103
|
|
|
95
104
|
|
|
@@ -129,6 +138,10 @@ def repl(ctx: click.Context) -> None:
|
|
|
129
138
|
table.add_row("grant", "Manage permissions")
|
|
130
139
|
table.add_row("history", "View command history")
|
|
131
140
|
table.add_row("favorite", "Manage favorite queries")
|
|
141
|
+
table.add_row("reflection", "Manage reflections")
|
|
142
|
+
table.add_row("wlm", "Manage queues/rules (Software)")
|
|
143
|
+
table.add_row("engine", "Manage engines")
|
|
144
|
+
table.add_row("script", "Manage SQL scripts")
|
|
132
145
|
table.add_row("help [command]", "Show help for command")
|
|
133
146
|
table.add_row("exit/quit", "Exit REPL")
|
|
134
147
|
|
|
@@ -10,6 +10,7 @@ def authenticate_with_username_password(
|
|
|
10
10
|
base_url: str,
|
|
11
11
|
username: str,
|
|
12
12
|
password: str,
|
|
13
|
+
verify: bool = True,
|
|
13
14
|
) -> str:
|
|
14
15
|
"""Authenticate with username and password (Dremio Software only).
|
|
15
16
|
|
|
@@ -25,7 +26,14 @@ def authenticate_with_username_password(
|
|
|
25
26
|
AuthenticationError: If authentication fails
|
|
26
27
|
"""
|
|
27
28
|
# Use v2 API for login
|
|
28
|
-
|
|
29
|
+
# Handle base URLs that might include /api/v3 or trailing slashes
|
|
30
|
+
clean_base_url = base_url.rstrip("/")
|
|
31
|
+
if clean_base_url.endswith("/api/v3"):
|
|
32
|
+
clean_base_url = clean_base_url[:-7] # remove /api/v3
|
|
33
|
+
elif clean_base_url.endswith("/api/v2"):
|
|
34
|
+
clean_base_url = clean_base_url[:-7] # remove /api/v2 if present
|
|
35
|
+
|
|
36
|
+
login_url = f"{clean_base_url}/apiv2/login"
|
|
29
37
|
|
|
30
38
|
try:
|
|
31
39
|
response = requests.post(
|
|
@@ -33,6 +41,7 @@ def authenticate_with_username_password(
|
|
|
33
41
|
json={"userName": username, "password": password},
|
|
34
42
|
headers={"Content-Type": "application/json"},
|
|
35
43
|
timeout=30,
|
|
44
|
+
verify=verify,
|
|
36
45
|
)
|
|
37
46
|
|
|
38
47
|
if not response.ok:
|
|
@@ -19,6 +19,7 @@ class BaseClient:
|
|
|
19
19
|
token: Optional[str] = None,
|
|
20
20
|
timeout: int = 30,
|
|
21
21
|
max_retries: int = 3,
|
|
22
|
+
verify: bool = True,
|
|
22
23
|
):
|
|
23
24
|
"""Initialize base client.
|
|
24
25
|
|
|
@@ -26,11 +27,14 @@ class BaseClient:
|
|
|
26
27
|
base_url: Base URL for API
|
|
27
28
|
token: Authentication token
|
|
28
29
|
timeout: Request timeout in seconds
|
|
30
|
+
timeout: Request timeout in seconds
|
|
29
31
|
max_retries: Maximum number of retries
|
|
32
|
+
verify: Verify SSL certificates (default: True)
|
|
30
33
|
"""
|
|
31
34
|
self.base_url = base_url.rstrip("/")
|
|
32
35
|
self.token = token
|
|
33
36
|
self.timeout = timeout
|
|
37
|
+
self.verify = verify
|
|
34
38
|
|
|
35
39
|
# Create session with retry logic
|
|
36
40
|
self.session = requests.Session()
|
|
@@ -56,7 +60,10 @@ class BaseClient:
|
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
if self.token:
|
|
59
|
-
|
|
63
|
+
if self.token.startswith("_dremio"):
|
|
64
|
+
headers["Authorization"] = self.token
|
|
65
|
+
else:
|
|
66
|
+
headers["Authorization"] = f"Bearer {self.token}"
|
|
60
67
|
|
|
61
68
|
return headers
|
|
62
69
|
|
|
@@ -172,11 +179,12 @@ class BaseClient:
|
|
|
172
179
|
)
|
|
173
180
|
return self._handle_response(response)
|
|
174
181
|
|
|
175
|
-
def delete(self, endpoint: str) -> Any:
|
|
182
|
+
def delete(self, endpoint: str, params: Optional[Dict[str, Any]] = None) -> Any:
|
|
176
183
|
"""Make DELETE request.
|
|
177
184
|
|
|
178
185
|
Args:
|
|
179
186
|
endpoint: API endpoint
|
|
187
|
+
params: Query parameters
|
|
180
188
|
|
|
181
189
|
Returns:
|
|
182
190
|
Response data
|
|
@@ -185,6 +193,8 @@ class BaseClient:
|
|
|
185
193
|
response = self.session.delete(
|
|
186
194
|
url,
|
|
187
195
|
headers=self._get_headers(),
|
|
196
|
+
params=params,
|
|
188
197
|
timeout=self.timeout,
|
|
198
|
+
verify=self.verify,
|
|
189
199
|
)
|
|
190
200
|
return self._handle_response(response)
|
|
@@ -14,6 +14,7 @@ class CloudClient(BaseClient):
|
|
|
14
14
|
project_id: str,
|
|
15
15
|
token: str,
|
|
16
16
|
timeout: int = 30,
|
|
17
|
+
verify: bool = True,
|
|
17
18
|
):
|
|
18
19
|
"""Initialize Cloud client.
|
|
19
20
|
|
|
@@ -22,8 +23,9 @@ class CloudClient(BaseClient):
|
|
|
22
23
|
project_id: Project ID
|
|
23
24
|
token: Authentication token
|
|
24
25
|
timeout: Request timeout in seconds
|
|
26
|
+
verify: Verify SSL certificates
|
|
25
27
|
"""
|
|
26
|
-
super().__init__(base_url, token, timeout)
|
|
28
|
+
super().__init__(base_url, token, timeout, verify=verify)
|
|
27
29
|
self.project_id = project_id
|
|
28
30
|
|
|
29
31
|
def _project_endpoint(self, endpoint: str) -> str:
|
|
@@ -286,25 +288,168 @@ class CloudClient(BaseClient):
|
|
|
286
288
|
return self.post(self._project_endpoint("role"), data=role_data)
|
|
287
289
|
|
|
288
290
|
def update_role(self, role_id: str, role_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
289
|
-
"""Update a role."""
|
|
290
291
|
return self.put(self._project_endpoint(f"role/{role_id}"), data=role_data)
|
|
291
292
|
|
|
292
293
|
def delete_role(self, role_id: str) -> None:
|
|
293
294
|
"""Delete a role."""
|
|
294
|
-
|
|
295
|
+
raise NotImplementedError("Role management is not available in Dremio Cloud API")
|
|
295
296
|
|
|
296
297
|
def add_role_member(self, role_id: str, user_id: str) -> None:
|
|
297
298
|
"""Add a user to a role."""
|
|
298
|
-
|
|
299
|
+
raise NotImplementedError("Role management is not available in Dremio Cloud API")
|
|
299
300
|
|
|
300
301
|
def remove_role_member(self, role_id: str, user_id: str) -> None:
|
|
301
302
|
"""Remove a user from a role."""
|
|
302
|
-
|
|
303
|
+
raise NotImplementedError("Role management is not available in Dremio Cloud API")
|
|
304
|
+
|
|
305
|
+
# -------------------------
|
|
306
|
+
# Reflection Operations
|
|
307
|
+
# -------------------------
|
|
308
|
+
|
|
309
|
+
def list_reflections(self) -> Dict[str, Any]:
|
|
310
|
+
"""List reflections.
|
|
311
|
+
|
|
312
|
+
Returns:
|
|
313
|
+
List of reflections
|
|
314
|
+
"""
|
|
315
|
+
# Checks /v0/projects/{id}/reflection
|
|
316
|
+
return self.get(self._project_endpoint("reflection"))
|
|
317
|
+
|
|
318
|
+
def get_reflection(self, reflection_id: str) -> Dict[str, Any]:
|
|
319
|
+
"""Get reflection by ID.
|
|
320
|
+
|
|
321
|
+
Args:
|
|
322
|
+
reflection_id: Reflection ID
|
|
323
|
+
|
|
324
|
+
Returns:
|
|
325
|
+
Reflection details
|
|
326
|
+
"""
|
|
327
|
+
return self.get(self._project_endpoint(f"reflection/{reflection_id}"))
|
|
328
|
+
|
|
329
|
+
def create_reflection(self, reflection_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
330
|
+
"""Create a reflection.
|
|
331
|
+
|
|
332
|
+
Args:
|
|
333
|
+
reflection_data: Reflection definition
|
|
334
|
+
|
|
335
|
+
Returns:
|
|
336
|
+
Created reflection
|
|
337
|
+
"""
|
|
338
|
+
return self.post(self._project_endpoint("reflection"), data=reflection_data)
|
|
339
|
+
|
|
340
|
+
def update_reflection(self, reflection_id: str, reflection_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
341
|
+
"""Update a reflection.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
reflection_id: Reflection ID
|
|
345
|
+
reflection_data: Updated reflection definition
|
|
346
|
+
|
|
347
|
+
Returns:
|
|
348
|
+
Updated reflection
|
|
349
|
+
"""
|
|
350
|
+
return self.put(self._project_endpoint(f"reflection/{reflection_id}"), data=reflection_data)
|
|
351
|
+
|
|
352
|
+
def delete_reflection(self, reflection_id: str) -> None:
|
|
353
|
+
"""Delete a reflection.
|
|
354
|
+
|
|
355
|
+
Args:
|
|
356
|
+
reflection_id: Reflection ID
|
|
357
|
+
"""
|
|
358
|
+
self.delete(self._project_endpoint(f"reflection/{reflection_id}"))
|
|
359
|
+
|
|
360
|
+
# -------------------------
|
|
361
|
+
# Engine Operations
|
|
362
|
+
# -------------------------
|
|
363
|
+
|
|
364
|
+
def list_engines(self) -> Dict[str, Any]:
|
|
365
|
+
"""List engines.
|
|
366
|
+
|
|
367
|
+
Returns:
|
|
368
|
+
List of engines
|
|
369
|
+
"""
|
|
370
|
+
return self.get(self._project_endpoint("engines"))
|
|
371
|
+
|
|
372
|
+
def get_engine(self, engine_id: str) -> Dict[str, Any]:
|
|
373
|
+
"""Get engine by ID.
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
engine_id: Engine ID
|
|
377
|
+
|
|
378
|
+
Returns:
|
|
379
|
+
Engine details
|
|
380
|
+
"""
|
|
381
|
+
return self.get(self._project_endpoint(f"engines/{engine_id}"))
|
|
382
|
+
|
|
303
383
|
|
|
304
384
|
# Table operations
|
|
305
385
|
def promote_dataset(self, dataset_id: str) -> Dict[str, Any]:
|
|
306
386
|
"""Promote a dataset to a physical dataset."""
|
|
307
|
-
|
|
387
|
+
# This implementation might vary for Cloud, usually via catalog
|
|
388
|
+
pass
|
|
389
|
+
|
|
390
|
+
# -------------------------
|
|
391
|
+
# Script Operations
|
|
392
|
+
# -------------------------
|
|
393
|
+
|
|
394
|
+
def list_scripts(self) -> Dict[str, Any]:
|
|
395
|
+
"""List scripts.
|
|
396
|
+
|
|
397
|
+
Returns:
|
|
398
|
+
List of scripts
|
|
399
|
+
"""
|
|
400
|
+
return self.get(self._project_endpoint("scripts"))
|
|
401
|
+
|
|
402
|
+
def get_script(self, script_id: str) -> Dict[str, Any]:
|
|
403
|
+
"""Get script by ID.
|
|
404
|
+
|
|
405
|
+
Args:
|
|
406
|
+
script_id: Script ID
|
|
407
|
+
|
|
408
|
+
Returns:
|
|
409
|
+
Script details
|
|
410
|
+
"""
|
|
411
|
+
return self.get(self._project_endpoint(f"scripts/{script_id}"))
|
|
412
|
+
|
|
413
|
+
def create_script(self, name: str, content: str, context: list = None) -> Dict[str, Any]:
|
|
414
|
+
"""Create a script.
|
|
415
|
+
|
|
416
|
+
Args:
|
|
417
|
+
name: Script name
|
|
418
|
+
content: SQL content
|
|
419
|
+
context: Context list (optional)
|
|
420
|
+
|
|
421
|
+
Returns:
|
|
422
|
+
Created script
|
|
423
|
+
"""
|
|
424
|
+
payload = {"name": name, "content": content}
|
|
425
|
+
if context:
|
|
426
|
+
payload["context"] = context
|
|
427
|
+
return self.post(self._project_endpoint("scripts"), data=payload)
|
|
428
|
+
|
|
429
|
+
def update_script(self, script_id: str, name: str, content: str, context: list = None) -> Dict[str, Any]:
|
|
430
|
+
"""Update a script.
|
|
431
|
+
|
|
432
|
+
Args:
|
|
433
|
+
script_id: Script ID
|
|
434
|
+
name: Script name
|
|
435
|
+
content: SQL content
|
|
436
|
+
context: Context list
|
|
437
|
+
|
|
438
|
+
Returns:
|
|
439
|
+
Updated script
|
|
440
|
+
"""
|
|
441
|
+
payload = {"name": name, "content": content}
|
|
442
|
+
if context:
|
|
443
|
+
payload["context"] = context
|
|
444
|
+
return self.put(self._project_endpoint(f"scripts/{script_id}"), data=payload)
|
|
445
|
+
|
|
446
|
+
def delete_script(self, script_id: str) -> None:
|
|
447
|
+
"""Delete a script.
|
|
448
|
+
|
|
449
|
+
Args:
|
|
450
|
+
script_id: Script ID
|
|
451
|
+
"""
|
|
452
|
+
self.delete(self._project_endpoint(f"scripts/{script_id}"))
|
|
308
453
|
|
|
309
454
|
def set_dataset_format(self, dataset_id: str, format_config: Dict[str, Any]) -> Dict[str, Any]:
|
|
310
455
|
"""Set format configuration for a dataset."""
|
|
@@ -52,11 +52,18 @@ def create_client(profile: Dict[str, Any]) -> Union[CloudClient, SoftwareClient]
|
|
|
52
52
|
base_url=base_url,
|
|
53
53
|
project_id=project_id,
|
|
54
54
|
token=token,
|
|
55
|
+
verify=profile.get("verify", True),
|
|
55
56
|
)
|
|
56
57
|
else: # software
|
|
58
|
+
# Ensure base_url ends with /api/v3 for software/v25
|
|
59
|
+
software_base_url = base_url.rstrip("/")
|
|
60
|
+
if not software_base_url.endswith("/api/v3"):
|
|
61
|
+
software_base_url = f"{software_base_url}/api/v3"
|
|
62
|
+
|
|
57
63
|
return SoftwareClient(
|
|
58
|
-
base_url=
|
|
64
|
+
base_url=software_base_url,
|
|
59
65
|
token=token,
|
|
66
|
+
verify=profile.get("verify", True),
|
|
60
67
|
)
|
|
61
68
|
|
|
62
69
|
|
|
@@ -112,7 +119,8 @@ def _get_token(profile: Dict[str, Any], auth: Dict[str, Any], base_url: str) ->
|
|
|
112
119
|
"Username/password auth only supported for Dremio Software"
|
|
113
120
|
)
|
|
114
121
|
|
|
115
|
-
|
|
122
|
+
verify = profile.get("verify", True)
|
|
123
|
+
token = authenticate_with_username_password(base_url, username, password, verify=verify)
|
|
116
124
|
|
|
117
125
|
# TODO: Cache token in profile for future use
|
|
118
126
|
|