dremio-cli 1.8.0__tar.gz → 1.9.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.8.0/dremio_cli.egg-info → dremio_cli-1.9.0}/PKG-INFO +1 -1
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/README.md +4 -2
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/profiles.md +3 -2
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/quickstart.md +6 -5
- dremio_cli-1.9.0/docs/service_users.md +39 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/auth.py +47 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/factory.py +15 -2
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/profile.py +15 -7
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/table.py +90 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/user.py +20 -11
- dremio_cli-1.9.0/dremio_cli/config.py +435 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/utils/validators.py +1 -1
- {dremio_cli-1.8.0 → dremio_cli-1.9.0/dremio_cli.egg-info}/PKG-INFO +1 -1
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli.egg-info/SOURCES.txt +2 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/pyproject.toml +1 -1
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_config.py +8 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_integration.py +4 -6
- dremio_cli-1.9.0/tests/test_service_users.py +62 -0
- dremio_cli-1.8.0/dremio_cli/config.py +0 -193
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/LICENSE +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/MANIFEST.in +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/README.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/completions/dremio-completion.bash +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/completions/dremio-completion.zsh +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/advanced-features.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/catalog.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/completion.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac_governance.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac_reflections.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac_sources.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac_tables.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/dac_validations.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/favorites.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/grants.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/history.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/init.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/installation.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/jobs.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/lineage.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/monitor.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/reflections.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/repl.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/roles.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/scripts.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/sources.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/spaces-folders.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/sql.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/tables.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/tags-wiki.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/tui.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/users.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/docs/views.md +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/__main__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/cli.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/base.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/cloud.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/client/software.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/catalog.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/completion.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/favorite.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/folder.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/grant.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/history.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/init.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/job.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/lineage.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/monitor.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/reflection.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/repl.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/role.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/script.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/source.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/space.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/sql.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/sync.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/tag.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/udf.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/ui.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/view.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/commands/wiki.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/config.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/diff.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/graph.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/state.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/dac/sync.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/env.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/formatters/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/formatters/json.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/formatters/table.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/formatters/yaml.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/history.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/app.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/screens.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/widgets.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/utils/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/utils/console.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/utils/exceptions.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli/utils/helpers.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli.egg-info/dependency_links.txt +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli.egg-info/entry_points.txt +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli.egg-info/requires.txt +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/dremio_cli.egg-info/top_level.txt +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/setup.cfg +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/setup.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/__init__.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/conftest.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_grant_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_history_favorite.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_job_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_multi_sql_execution.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_reflection_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_role_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_script_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_source_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_space_folder_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_sql_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_table_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_tag_wiki_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_user_commands.py +0 -0
- {dremio_cli-1.8.0 → dremio_cli-1.9.0}/tests/test_view_commands.py +0 -0
|
@@ -30,8 +30,10 @@ Complete documentation for the Dremio Command Line Interface.
|
|
|
30
30
|
- **[History](history.md)** - View and re-run commands
|
|
31
31
|
|
|
32
32
|
### Administration
|
|
33
|
-
- **[Users](
|
|
34
|
-
- **[
|
|
33
|
+
- **[Users & Roles](users_roles.md)** - Manage users and Access Control
|
|
34
|
+
- **[Service Users & External Auth](service_users.md)** - Service accounts and IdP JWTs
|
|
35
|
+
- **[Dremio-as-Code Guide](dac.md)** - GitOps for Dremio
|
|
36
|
+
|
|
35
37
|
|
|
36
38
|
## 🚀 Quick Start
|
|
37
39
|
|
|
@@ -34,7 +34,8 @@ How you log in to Dremio.
|
|
|
34
34
|
|------|----------|-------------|
|
|
35
35
|
| **PAT** (Token) | Cloud & Software | **Recommended**. Personal Access Token generated in User Settings. |
|
|
36
36
|
| **Services Account** | Cloud Only | Treats Client/Secret as a PAT for automation. |
|
|
37
|
-
| **
|
|
37
|
+
| **Basic** | Software Only | Traditional username/password. **Less secure** than PAT. |
|
|
38
|
+
| **External JWT** | Cloud & Software | Identity Provider token exchange. |
|
|
38
39
|
|
|
39
40
|
### 3. Project ID (Cloud Only)
|
|
40
41
|
Can be found in the URL of your Dremio Cloud project.
|
|
@@ -79,7 +80,7 @@ profiles:
|
|
|
79
80
|
type: software
|
|
80
81
|
base_url: http://localhost:9047 # Default port
|
|
81
82
|
auth:
|
|
82
|
-
type:
|
|
83
|
+
type: basic
|
|
83
84
|
username: admin
|
|
84
85
|
password: password123
|
|
85
86
|
```
|
|
@@ -16,12 +16,13 @@ dremio profile create production \
|
|
|
16
16
|
### For Dremio Software
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
dremio profile create local \
|
|
19
|
+
dremio profile create --name local-dev \
|
|
20
20
|
--type software \
|
|
21
|
-
--base-url http://localhost:9047
|
|
22
|
-
--auth-type
|
|
23
|
-
--username
|
|
24
|
-
--password
|
|
21
|
+
--base-url http://localhost:9047 \
|
|
22
|
+
--auth-type basic \
|
|
23
|
+
--username admin \
|
|
24
|
+
--password secret
|
|
25
|
+
mio123
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
## 2. Verify Your Profile
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Service Users and External Authentication
|
|
2
|
+
|
|
3
|
+
## Service Users (Software Only)
|
|
4
|
+
Dremio Software allows creating "Service Users" (identityType: `SERVICE_USER`) which do not require a password and are typically used for automation via Personal Access Tokens (PATs).
|
|
5
|
+
|
|
6
|
+
### Creating a Service User
|
|
7
|
+
```bash
|
|
8
|
+
dremio user create --username svc_pipeline --type SERVICE
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
You can then log in as an admin (or user with privileges) to generate a PAT for this user via the API or UI.
|
|
12
|
+
|
|
13
|
+
### Creating a Local User (Default)
|
|
14
|
+
```bash
|
|
15
|
+
dremio user create --username john --password secret --name "John Doe" --email john@example.com
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## External JWT Authentication (Cloud & Software)
|
|
19
|
+
For environments integrating with external Identity Providers (IdP) like Okta or Microsoft Entra ID, you can configure your profile to use an **External JWT**. The CLI will automatically exchange this token for a Dremio Access Token via the `/oauth/token` endpoint (Token Exchange).
|
|
20
|
+
|
|
21
|
+
### 1. Get your External JWT
|
|
22
|
+
Obtain a valid JWT from your Identity Provider. This token must be valid and trusted by your Dremio instance.
|
|
23
|
+
|
|
24
|
+
### 2. Configure Profile
|
|
25
|
+
Use the `external_jwt` auth type and provide your IdP token.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dremio profile create --name my-idp-profile \
|
|
29
|
+
--type cloud \
|
|
30
|
+
--base-url https://api.dremio.cloud \
|
|
31
|
+
--project-id <PROJECT_ID> \
|
|
32
|
+
--auth-type external_jwt \
|
|
33
|
+
--token <YOUR_IDP_JWT>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Usage
|
|
37
|
+
The CLI will exchange the provided External JWT for a temporary Dremio Access Token for each session or command.
|
|
38
|
+
> [!NOTE]
|
|
39
|
+
> The CLI does not refresh the *External* JWT. If your IdP token expires, you must update the profile with a new one using `dremio profile update`.
|
|
@@ -103,3 +103,50 @@ def refresh_oauth_token(
|
|
|
103
103
|
|
|
104
104
|
except requests.RequestException as e:
|
|
105
105
|
raise AuthenticationError(f"Token refresh request failed: {e}")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def exchange_external_jwt(
|
|
109
|
+
base_url: str,
|
|
110
|
+
external_token: str,
|
|
111
|
+
) -> str:
|
|
112
|
+
"""Exchange external JWT for Dremio Access Token.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
base_url: Base URL for Dremio
|
|
116
|
+
external_token: External Identity Provider JWT
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
Dremio Access Token
|
|
120
|
+
|
|
121
|
+
Raises:
|
|
122
|
+
AuthenticationError: If exchange fails
|
|
123
|
+
"""
|
|
124
|
+
oauth_url = f"{base_url.rstrip('/')}/oauth/token"
|
|
125
|
+
|
|
126
|
+
data = {
|
|
127
|
+
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
|
|
128
|
+
"subject_token": external_token,
|
|
129
|
+
"subject_token_type": "urn:ietf:params:oauth:token-type:jwt"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try:
|
|
133
|
+
response = requests.post(
|
|
134
|
+
oauth_url,
|
|
135
|
+
data=data, # Form encoded
|
|
136
|
+
headers={"Content-Type": "application/x-www-form-urlencoded"},
|
|
137
|
+
timeout=30,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
if not response.ok:
|
|
141
|
+
raise AuthenticationError(f"Token exchange failed: {response.text}")
|
|
142
|
+
|
|
143
|
+
# Response should contain access_token
|
|
144
|
+
result = response.json()
|
|
145
|
+
token = result.get("access_token")
|
|
146
|
+
if not token:
|
|
147
|
+
raise AuthenticationError("No access_token in exchange response")
|
|
148
|
+
|
|
149
|
+
return token
|
|
150
|
+
|
|
151
|
+
except requests.RequestException as e:
|
|
152
|
+
raise AuthenticationError(f"Token exchange request failed: {e}")
|
|
@@ -4,7 +4,7 @@ from typing import Dict, Any, Union
|
|
|
4
4
|
|
|
5
5
|
from dremio_cli.client.cloud import CloudClient
|
|
6
6
|
from dremio_cli.client.software import SoftwareClient
|
|
7
|
-
from dremio_cli.client.auth import authenticate_with_username_password
|
|
7
|
+
from dremio_cli.client.auth import authenticate_with_username_password, exchange_external_jwt
|
|
8
8
|
from dremio_cli.utils.exceptions import ConfigurationError, AuthenticationError
|
|
9
9
|
|
|
10
10
|
|
|
@@ -90,7 +90,7 @@ def _get_token(profile: Dict[str, Any], auth: Dict[str, Any], base_url: str) ->
|
|
|
90
90
|
# TODO: Check if token is expired and refresh if needed
|
|
91
91
|
return token
|
|
92
92
|
|
|
93
|
-
elif auth_type == "
|
|
93
|
+
elif auth_type == "basic":
|
|
94
94
|
# Check if we have a cached token
|
|
95
95
|
cached_token = auth.get("token")
|
|
96
96
|
if cached_token:
|
|
@@ -117,6 +117,19 @@ def _get_token(profile: Dict[str, Any], auth: Dict[str, Any], base_url: str) ->
|
|
|
117
117
|
# TODO: Cache token in profile for future use
|
|
118
118
|
|
|
119
119
|
return token
|
|
120
|
+
|
|
121
|
+
elif auth_type == "external_jwt":
|
|
122
|
+
external_token = auth.get("external_token")
|
|
123
|
+
if not external_token:
|
|
124
|
+
# Fallback for older profiles or misconfiguration
|
|
125
|
+
external_token = auth.get("token")
|
|
126
|
+
|
|
127
|
+
if not external_token:
|
|
128
|
+
raise ConfigurationError("EXTERNAL_JWT auth requires 'external_token' field")
|
|
129
|
+
|
|
130
|
+
# Exchange for Dremio Token
|
|
131
|
+
token = exchange_external_jwt(base_url, external_token)
|
|
132
|
+
return token
|
|
120
133
|
|
|
121
134
|
else:
|
|
122
135
|
raise ConfigurationError(f"Unsupported auth type: {auth_type}")
|
|
@@ -85,10 +85,10 @@ def current_profile() -> None:
|
|
|
85
85
|
@click.option("--type", "profile_type", required=True, type=click.Choice(["cloud", "software"]))
|
|
86
86
|
@click.option("--base-url", required=True, help="Base URL for Dremio API")
|
|
87
87
|
@click.option("--project-id", help="Project ID (required for cloud)")
|
|
88
|
-
@click.option("--auth-type", required=True, type=click.Choice(["pat", "
|
|
89
|
-
@click.option("--token", help="Authentication token")
|
|
90
|
-
@click.option("--username", help="Username (for
|
|
91
|
-
@click.option("--password", help="Password (for
|
|
88
|
+
@click.option("--auth-type", required=True, type=click.Choice(["pat", "basic", "external_jwt"]))
|
|
89
|
+
@click.option("--token", help="Authentication token (PAT or External JWT)")
|
|
90
|
+
@click.option("--username", help="Username (for basic auth)")
|
|
91
|
+
@click.option("--password", help="Password (for basic auth)")
|
|
92
92
|
def create_profile(
|
|
93
93
|
name: str,
|
|
94
94
|
profile_type: str,
|
|
@@ -103,7 +103,7 @@ def create_profile(
|
|
|
103
103
|
try:
|
|
104
104
|
# Validate inputs
|
|
105
105
|
validate_profile_type(profile_type)
|
|
106
|
-
validate_auth_type(auth_type)
|
|
106
|
+
# validate_auth_type(auth_type) # Allow new types
|
|
107
107
|
validate_url(base_url)
|
|
108
108
|
|
|
109
109
|
# Validate cloud-specific requirements
|
|
@@ -111,11 +111,18 @@ def create_profile(
|
|
|
111
111
|
raise DremioCliError("--project-id is required for cloud profiles")
|
|
112
112
|
|
|
113
113
|
# Validate auth requirements
|
|
114
|
+
external_token = None
|
|
114
115
|
if auth_type == "pat" and not token:
|
|
115
116
|
raise DremioCliError("--token is required for PAT authentication")
|
|
116
117
|
|
|
117
|
-
if auth_type == "
|
|
118
|
-
|
|
118
|
+
if auth_type == "external_jwt":
|
|
119
|
+
if not token:
|
|
120
|
+
raise DremioCliError("--token is required for EXTERNAL_JWT authentication")
|
|
121
|
+
external_token = token
|
|
122
|
+
token = None # Clear main token, will be auto-fetched
|
|
123
|
+
|
|
124
|
+
if auth_type == "basic" and (not username or not password):
|
|
125
|
+
raise DremioCliError("--username and --password are required for basic authentication")
|
|
119
126
|
|
|
120
127
|
manager = ProfileManager()
|
|
121
128
|
manager.create_profile(
|
|
@@ -127,6 +134,7 @@ def create_profile(
|
|
|
127
134
|
token=token,
|
|
128
135
|
username=username,
|
|
129
136
|
password=password,
|
|
137
|
+
external_token=external_token,
|
|
130
138
|
)
|
|
131
139
|
|
|
132
140
|
console.print(f"[green]✓[/green] Profile '[cyan]{name}[/cyan]' created successfully")
|
|
@@ -153,3 +153,93 @@ def update_table(ctx, dataset_id: str, table_file: str) -> None:
|
|
|
153
153
|
import traceback
|
|
154
154
|
traceback.print_exc()
|
|
155
155
|
raise click.Abort()
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@table.command("get")
|
|
159
|
+
@click.argument("dataset_id")
|
|
160
|
+
@click.pass_context
|
|
161
|
+
def get_table(ctx, dataset_id: str) -> None:
|
|
162
|
+
"""Get table by ID.
|
|
163
|
+
|
|
164
|
+
Examples:
|
|
165
|
+
dremio table get abc-123
|
|
166
|
+
"""
|
|
167
|
+
try:
|
|
168
|
+
# Get profile
|
|
169
|
+
manager = ProfileManager()
|
|
170
|
+
profile_name = ctx.obj.profile_name
|
|
171
|
+
profile = manager.get_profile(profile_name)
|
|
172
|
+
|
|
173
|
+
if not profile:
|
|
174
|
+
console.print(f"[red]Profile '{profile_name}' not found[/red]")
|
|
175
|
+
raise click.Abort()
|
|
176
|
+
|
|
177
|
+
# Create client
|
|
178
|
+
client = create_client(profile)
|
|
179
|
+
|
|
180
|
+
# Get table
|
|
181
|
+
with console.status(f"[bold green]Fetching table {dataset_id}..."):
|
|
182
|
+
data = client.get_catalog_item(dataset_id)
|
|
183
|
+
|
|
184
|
+
# Format output
|
|
185
|
+
output_format = ctx.obj.output_format
|
|
186
|
+
|
|
187
|
+
if output_format == "json":
|
|
188
|
+
console.print(format_as_json(data))
|
|
189
|
+
elif output_format == "yaml":
|
|
190
|
+
console.print(format_as_yaml(data))
|
|
191
|
+
else:
|
|
192
|
+
format_as_table(data, title=f"Table: {dataset_id}")
|
|
193
|
+
|
|
194
|
+
except Exception as e:
|
|
195
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
196
|
+
if ctx.obj.verbose:
|
|
197
|
+
import traceback
|
|
198
|
+
traceback.print_exc()
|
|
199
|
+
raise click.Abort()
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@table.command("get-by-path")
|
|
203
|
+
@click.argument("path")
|
|
204
|
+
@click.pass_context
|
|
205
|
+
def get_table_by_path(ctx, path: str) -> None:
|
|
206
|
+
"""Get table by path.
|
|
207
|
+
|
|
208
|
+
Examples:
|
|
209
|
+
dremio table get-by-path space.folder.table
|
|
210
|
+
"""
|
|
211
|
+
try:
|
|
212
|
+
# Get profile
|
|
213
|
+
manager = ProfileManager()
|
|
214
|
+
profile_name = ctx.obj.profile_name
|
|
215
|
+
profile = manager.get_profile(profile_name)
|
|
216
|
+
|
|
217
|
+
if not profile:
|
|
218
|
+
console.print(f"[red]Profile '{profile_name}' not found[/red]")
|
|
219
|
+
raise click.Abort()
|
|
220
|
+
|
|
221
|
+
# Create client
|
|
222
|
+
client = create_client(profile)
|
|
223
|
+
|
|
224
|
+
# Get table by path
|
|
225
|
+
with console.status(f"[bold green]Fetching table {path}..."):
|
|
226
|
+
# Prepare path
|
|
227
|
+
path_list = path.split(".")
|
|
228
|
+
data = client.get_catalog_item_by_path(path_list)
|
|
229
|
+
|
|
230
|
+
# Format output
|
|
231
|
+
output_format = ctx.obj.output_format
|
|
232
|
+
|
|
233
|
+
if output_format == "json":
|
|
234
|
+
console.print(format_as_json(data))
|
|
235
|
+
elif output_format == "yaml":
|
|
236
|
+
console.print(format_as_yaml(data))
|
|
237
|
+
else:
|
|
238
|
+
format_as_table(data, title=f"Table: {path}")
|
|
239
|
+
|
|
240
|
+
except Exception as e:
|
|
241
|
+
console.print(f"[red]Error: {e}[/red]")
|
|
242
|
+
if ctx.obj.verbose:
|
|
243
|
+
import traceback
|
|
244
|
+
traceback.print_exc()
|
|
245
|
+
raise click.Abort()
|
|
@@ -113,18 +113,19 @@ def get_user(ctx, user_id: str) -> None:
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
@user.command("create")
|
|
116
|
-
@click.option("--name", required=
|
|
117
|
-
@click.option("--email", required=
|
|
118
|
-
@click.option("--username", help="Username
|
|
119
|
-
@click.option("--password", help="Initial password")
|
|
116
|
+
@click.option("--name", required=False, help="User full name")
|
|
117
|
+
@click.option("--email", required=False, help="User email")
|
|
118
|
+
@click.option("--username", required=True, help="Username")
|
|
119
|
+
@click.option("--password", help="Initial password (required for LOCAL users)")
|
|
120
|
+
@click.option("--type", "user_type", type=click.Choice(["LOCAL", "SERVICE"]), default="LOCAL", help="User type")
|
|
120
121
|
@click.option("--from-file", "user_file", type=click.Path(exists=True), help="Load user from JSON file")
|
|
121
122
|
@click.pass_context
|
|
122
|
-
def create_user(ctx, name: str, email: str, username: str, password: str, user_file: str) -> None:
|
|
123
|
+
def create_user(ctx, name: str, email: str, username: str, password: str, user_type: str, user_file: str) -> None:
|
|
123
124
|
"""Create a new user.
|
|
124
125
|
|
|
125
126
|
Examples:
|
|
126
|
-
dremio user create --name "John Doe" --email john@company.com
|
|
127
|
-
dremio user create --
|
|
127
|
+
dremio user create --username john --password secret --name "John Doe" --email john@company.com
|
|
128
|
+
dremio user create --username svc_account --type SERVICE
|
|
128
129
|
"""
|
|
129
130
|
try:
|
|
130
131
|
# Get profile
|
|
@@ -145,11 +146,19 @@ def create_user(ctx, name: str, email: str, username: str, password: str, user_f
|
|
|
145
146
|
user_data = json.load(f)
|
|
146
147
|
else:
|
|
147
148
|
user_data = {
|
|
148
|
-
"
|
|
149
|
-
"email": email,
|
|
150
|
-
"userName": username or email
|
|
149
|
+
"userName": username
|
|
151
150
|
}
|
|
152
|
-
if
|
|
151
|
+
if name:
|
|
152
|
+
user_data["name"] = name
|
|
153
|
+
if email:
|
|
154
|
+
user_data["email"] = email
|
|
155
|
+
|
|
156
|
+
if user_type == "SERVICE":
|
|
157
|
+
user_data["identityType"] = "SERVICE_USER"
|
|
158
|
+
# Service users don't have passwords
|
|
159
|
+
else:
|
|
160
|
+
if not password:
|
|
161
|
+
raise click.BadParameter("Password is required for LOCAL users", param_hint="--password")
|
|
153
162
|
user_data["password"] = password
|
|
154
163
|
|
|
155
164
|
# Create user
|