dremio-cli 1.8.1__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.
Files changed (126) hide show
  1. {dremio_cli-1.8.1/dremio_cli.egg-info → dremio_cli-1.9.0}/PKG-INFO +1 -1
  2. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/README.md +2 -3
  3. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/profiles.md +3 -2
  4. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/quickstart.md +6 -5
  5. dremio_cli-1.9.0/docs/service_users.md +39 -0
  6. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/auth.py +49 -2
  7. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/factory.py +15 -2
  8. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/profile.py +15 -7
  9. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/table.py +90 -0
  10. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/user.py +20 -11
  11. dremio_cli-1.9.0/dremio_cli/config.py +435 -0
  12. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/utils/validators.py +1 -1
  13. {dremio_cli-1.8.1 → dremio_cli-1.9.0/dremio_cli.egg-info}/PKG-INFO +1 -1
  14. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli.egg-info/SOURCES.txt +2 -0
  15. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/pyproject.toml +1 -1
  16. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_config.py +8 -0
  17. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_integration.py +4 -6
  18. dremio_cli-1.9.0/tests/test_service_users.py +62 -0
  19. dremio_cli-1.8.1/dremio_cli/config.py +0 -193
  20. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/LICENSE +0 -0
  21. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/MANIFEST.in +0 -0
  22. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/README.md +0 -0
  23. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/completions/dremio-completion.bash +0 -0
  24. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/completions/dremio-completion.zsh +0 -0
  25. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/advanced-features.md +0 -0
  26. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/catalog.md +0 -0
  27. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/completion.md +0 -0
  28. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac.md +0 -0
  29. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac_governance.md +0 -0
  30. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac_reflections.md +0 -0
  31. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac_sources.md +0 -0
  32. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac_tables.md +0 -0
  33. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/dac_validations.md +0 -0
  34. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/favorites.md +0 -0
  35. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/grants.md +0 -0
  36. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/history.md +0 -0
  37. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/init.md +0 -0
  38. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/installation.md +0 -0
  39. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/jobs.md +0 -0
  40. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/lineage.md +0 -0
  41. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/monitor.md +0 -0
  42. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/reflections.md +0 -0
  43. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/repl.md +0 -0
  44. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/roles.md +0 -0
  45. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/scripts.md +0 -0
  46. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/sources.md +0 -0
  47. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/spaces-folders.md +0 -0
  48. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/sql.md +0 -0
  49. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/tables.md +0 -0
  50. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/tags-wiki.md +0 -0
  51. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/tui.md +0 -0
  52. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/users.md +0 -0
  53. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/docs/views.md +0 -0
  54. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/__init__.py +0 -0
  55. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/__main__.py +0 -0
  56. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/cli.py +0 -0
  57. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/__init__.py +0 -0
  58. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/base.py +0 -0
  59. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/cloud.py +0 -0
  60. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/client/software.py +0 -0
  61. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/__init__.py +0 -0
  62. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/catalog.py +0 -0
  63. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/completion.py +0 -0
  64. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/favorite.py +0 -0
  65. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/folder.py +0 -0
  66. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/grant.py +0 -0
  67. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/history.py +0 -0
  68. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/init.py +0 -0
  69. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/job.py +0 -0
  70. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/lineage.py +0 -0
  71. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/monitor.py +0 -0
  72. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/reflection.py +0 -0
  73. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/repl.py +0 -0
  74. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/role.py +0 -0
  75. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/script.py +0 -0
  76. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/source.py +0 -0
  77. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/space.py +0 -0
  78. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/sql.py +0 -0
  79. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/sync.py +0 -0
  80. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/tag.py +0 -0
  81. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/udf.py +0 -0
  82. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/ui.py +0 -0
  83. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/view.py +0 -0
  84. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/commands/wiki.py +0 -0
  85. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/__init__.py +0 -0
  86. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/config.py +0 -0
  87. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/diff.py +0 -0
  88. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/graph.py +0 -0
  89. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/state.py +0 -0
  90. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/dac/sync.py +0 -0
  91. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/env.py +0 -0
  92. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/formatters/__init__.py +0 -0
  93. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/formatters/json.py +0 -0
  94. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/formatters/table.py +0 -0
  95. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/formatters/yaml.py +0 -0
  96. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/history.py +0 -0
  97. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/__init__.py +0 -0
  98. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/app.py +0 -0
  99. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/screens.py +0 -0
  100. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/tui/catalog/widgets.py +0 -0
  101. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/utils/__init__.py +0 -0
  102. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/utils/console.py +0 -0
  103. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/utils/exceptions.py +0 -0
  104. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli/utils/helpers.py +0 -0
  105. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli.egg-info/dependency_links.txt +0 -0
  106. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli.egg-info/entry_points.txt +0 -0
  107. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli.egg-info/requires.txt +0 -0
  108. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/dremio_cli.egg-info/top_level.txt +0 -0
  109. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/setup.cfg +0 -0
  110. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/setup.py +0 -0
  111. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/__init__.py +0 -0
  112. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/conftest.py +0 -0
  113. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_grant_commands.py +0 -0
  114. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_history_favorite.py +0 -0
  115. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_job_commands.py +0 -0
  116. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_multi_sql_execution.py +0 -0
  117. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_reflection_commands.py +0 -0
  118. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_role_commands.py +0 -0
  119. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_script_commands.py +0 -0
  120. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_source_commands.py +0 -0
  121. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_space_folder_commands.py +0 -0
  122. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_sql_commands.py +0 -0
  123. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_table_commands.py +0 -0
  124. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_tag_wiki_commands.py +0 -0
  125. {dremio_cli-1.8.1 → dremio_cli-1.9.0}/tests/test_user_commands.py +0 -0
  126. {dremio_cli-1.8.1 → dremio_cli-1.9.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.8.1
3
+ Version: 1.9.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
@@ -30,9 +30,8 @@ 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](users.md)** - User account management
34
- - **[Roles](roles.md)** - Role-based access control
35
-
33
+ - **[Users & Roles](users_roles.md)** - Manage users and Access Control
34
+ - **[Service Users & External Auth](service_users.md)** - Service accounts and IdP JWTs
36
35
  - **[Dremio-as-Code Guide](dac.md)** - GitOps for Dremio
37
36
 
38
37
 
@@ -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
- | **Username/Password** | Software Only | Traditional login. **Less secure** than PAT. |
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: username_password
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/api/v3 \
22
- --auth-type username_password \
23
- --username dremio \
24
- --password dremio123
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`.
@@ -49,8 +49,8 @@ def authenticate_with_username_password(
49
49
  if not token:
50
50
  raise AuthenticationError("No token in authentication response")
51
51
 
52
- # Return raw token (BaseClient adds prefix)
53
- return token
52
+ # Return self-contained token
53
+ return f"_dremio{token}"
54
54
 
55
55
  except requests.RequestException as e:
56
56
  raise AuthenticationError(f"Authentication request failed: {e}")
@@ -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 == "username_password":
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", "oauth", "username_password"]))
89
- @click.option("--token", help="Authentication token")
90
- @click.option("--username", help="Username (for username_password auth)")
91
- @click.option("--password", help="Password (for username_password auth)")
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 == "username_password" and (not username or not password):
118
- raise DremioCliError("--username and --password are required for username_password authentication")
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=True, help="User full name")
117
- @click.option("--email", required=True, help="User email")
118
- @click.option("--username", help="Username (defaults to email)")
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 --from-file user.json
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
- "name": name,
149
- "email": email,
150
- "userName": username or email
149
+ "userName": username
151
150
  }
152
- if password:
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