pltr-cli 0.12.0__py3-none-any.whl → 0.13.0__py3-none-any.whl
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.
- pltr/__init__.py +1 -1
- pltr/cli.py +24 -0
- pltr/commands/admin.py +12 -2
- pltr/commands/functions.py +503 -0
- pltr/commands/language_models.py +515 -0
- pltr/commands/models.py +362 -0
- pltr/commands/project.py +21 -61
- pltr/commands/resource.py +0 -53
- pltr/commands/space.py +25 -303
- pltr/commands/streams.py +616 -0
- pltr/services/admin.py +15 -4
- pltr/services/dataset.py +2 -3
- pltr/services/folder.py +6 -1
- pltr/services/functions.py +223 -0
- pltr/services/language_models.py +281 -0
- pltr/services/models.py +179 -0
- pltr/services/project.py +87 -49
- pltr/services/resource.py +14 -72
- pltr/services/space.py +24 -175
- pltr/services/streams.py +290 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/METADATA +51 -2
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/RECORD +25 -17
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/WHEEL +0 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.12.0.dist-info → pltr_cli-0.13.0.dist-info}/licenses/LICENSE +0 -0
pltr/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.13.0"
|
pltr/cli.py
CHANGED
|
@@ -26,6 +26,10 @@ from pltr.commands import (
|
|
|
26
26
|
connectivity,
|
|
27
27
|
third_party_applications,
|
|
28
28
|
aip_agents,
|
|
29
|
+
functions,
|
|
30
|
+
streams,
|
|
31
|
+
language_models,
|
|
32
|
+
models,
|
|
29
33
|
)
|
|
30
34
|
from pltr.commands.cp import cp_command
|
|
31
35
|
|
|
@@ -67,6 +71,26 @@ app.add_typer(
|
|
|
67
71
|
name="aip-agents",
|
|
68
72
|
help="Manage AIP Agents, sessions, and versions",
|
|
69
73
|
)
|
|
74
|
+
app.add_typer(
|
|
75
|
+
functions.app,
|
|
76
|
+
name="functions",
|
|
77
|
+
help="Manage Functions queries and value types",
|
|
78
|
+
)
|
|
79
|
+
app.add_typer(
|
|
80
|
+
streams.app,
|
|
81
|
+
name="streams",
|
|
82
|
+
help="Manage streaming datasets and streams",
|
|
83
|
+
)
|
|
84
|
+
app.add_typer(
|
|
85
|
+
language_models.app,
|
|
86
|
+
name="language-models",
|
|
87
|
+
help="Interact with language models (Claude, OpenAI embeddings)",
|
|
88
|
+
)
|
|
89
|
+
app.add_typer(
|
|
90
|
+
models.app,
|
|
91
|
+
name="models",
|
|
92
|
+
help="Manage ML models and versions",
|
|
93
|
+
)
|
|
70
94
|
app.add_typer(
|
|
71
95
|
admin.app,
|
|
72
96
|
name="admin",
|
pltr/commands/admin.py
CHANGED
|
@@ -394,12 +394,22 @@ def list_groups(
|
|
|
394
394
|
with SpinnerProgressTracker().track_spinner("Fetching groups..."):
|
|
395
395
|
result = service.list_groups(page_size=page_size, page_token=page_token)
|
|
396
396
|
|
|
397
|
+
# Extract data from result (service returns {data: [...], next_page_token: ...})
|
|
398
|
+
groups = result.get("data", [])
|
|
399
|
+
next_token = result.get("next_page_token")
|
|
400
|
+
|
|
397
401
|
# Format and display results
|
|
398
402
|
if output_file:
|
|
399
|
-
formatter.save_to_file(
|
|
403
|
+
formatter.save_to_file(groups, output_file, output_format)
|
|
400
404
|
console.print(f"Results saved to {output_file}")
|
|
401
405
|
else:
|
|
402
|
-
formatter.display(
|
|
406
|
+
formatter.display(groups, output_format)
|
|
407
|
+
|
|
408
|
+
# Show pagination info
|
|
409
|
+
if next_token:
|
|
410
|
+
console.print(
|
|
411
|
+
f"\n[dim]More results available. Use --page-token {next_token} to continue[/dim]"
|
|
412
|
+
)
|
|
403
413
|
|
|
404
414
|
except Exception as e:
|
|
405
415
|
console.print(f"[red]Error:[/red] {e}")
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Functions management commands for Foundry.
|
|
3
|
+
Provides commands for query execution and value type inspection.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
import json
|
|
8
|
+
from typing import Optional
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
|
|
12
|
+
from ..services.functions import FunctionsService
|
|
13
|
+
from ..utils.formatting import OutputFormatter
|
|
14
|
+
from ..utils.progress import SpinnerProgressTracker
|
|
15
|
+
from ..auth.base import ProfileNotFoundError, MissingCredentialsError
|
|
16
|
+
from ..utils.completion import (
|
|
17
|
+
complete_rid,
|
|
18
|
+
complete_profile,
|
|
19
|
+
complete_output_format,
|
|
20
|
+
cache_rid,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Create main app and sub-apps
|
|
24
|
+
app = typer.Typer(help="Manage Functions queries and value types")
|
|
25
|
+
query_app = typer.Typer(help="Manage and execute queries")
|
|
26
|
+
value_type_app = typer.Typer(help="Manage value types")
|
|
27
|
+
|
|
28
|
+
# Add sub-apps
|
|
29
|
+
app.add_typer(query_app, name="query")
|
|
30
|
+
app.add_typer(value_type_app, name="value-type")
|
|
31
|
+
|
|
32
|
+
console = Console()
|
|
33
|
+
formatter = OutputFormatter(console)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def parse_parameters(parameters_str: Optional[str]) -> Optional[dict]:
|
|
37
|
+
"""
|
|
38
|
+
Parse parameters from string or file.
|
|
39
|
+
|
|
40
|
+
Supports:
|
|
41
|
+
- Inline JSON: '{"key": "value"}'
|
|
42
|
+
- File reference: @params.json
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
parameters_str: Parameter string or file reference
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
Parsed parameters dictionary or None
|
|
49
|
+
|
|
50
|
+
Raises:
|
|
51
|
+
FileNotFoundError: If file reference doesn't exist
|
|
52
|
+
json.JSONDecodeError: If JSON is invalid
|
|
53
|
+
"""
|
|
54
|
+
if not parameters_str:
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
# Handle file reference
|
|
58
|
+
if parameters_str.startswith("@"):
|
|
59
|
+
file_path = Path(parameters_str[1:])
|
|
60
|
+
if not file_path.exists():
|
|
61
|
+
raise FileNotFoundError(f"Parameter file not found: {file_path}")
|
|
62
|
+
|
|
63
|
+
with open(file_path, "r") as f:
|
|
64
|
+
return json.load(f)
|
|
65
|
+
|
|
66
|
+
# Handle inline JSON
|
|
67
|
+
return json.loads(parameters_str)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@query_app.command("get")
|
|
71
|
+
def get_query(
|
|
72
|
+
query_api_name: str = typer.Argument(
|
|
73
|
+
...,
|
|
74
|
+
help="Query API name (e.g., myQuery)",
|
|
75
|
+
),
|
|
76
|
+
version: Optional[str] = typer.Option(
|
|
77
|
+
None,
|
|
78
|
+
"--version",
|
|
79
|
+
"-v",
|
|
80
|
+
help="Query version to retrieve (e.g., '1.0.0'). Defaults to latest.",
|
|
81
|
+
),
|
|
82
|
+
profile: Optional[str] = typer.Option(
|
|
83
|
+
None,
|
|
84
|
+
"--profile",
|
|
85
|
+
"-p",
|
|
86
|
+
help="Profile name",
|
|
87
|
+
autocompletion=complete_profile,
|
|
88
|
+
),
|
|
89
|
+
format: str = typer.Option(
|
|
90
|
+
"table",
|
|
91
|
+
"--format",
|
|
92
|
+
"-f",
|
|
93
|
+
help="Output format (table, json, csv)",
|
|
94
|
+
autocompletion=complete_output_format,
|
|
95
|
+
),
|
|
96
|
+
output: Optional[str] = typer.Option(
|
|
97
|
+
None, "--output", "-o", help="Output file path"
|
|
98
|
+
),
|
|
99
|
+
preview: bool = typer.Option(
|
|
100
|
+
False,
|
|
101
|
+
"--preview",
|
|
102
|
+
help="Enable preview mode",
|
|
103
|
+
),
|
|
104
|
+
):
|
|
105
|
+
"""
|
|
106
|
+
Get query metadata by API name.
|
|
107
|
+
|
|
108
|
+
Retrieves query configuration including parameters, output structure,
|
|
109
|
+
and version information.
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
|
|
113
|
+
# Get latest version of query
|
|
114
|
+
pltr functions query get myQuery
|
|
115
|
+
|
|
116
|
+
# Get specific version
|
|
117
|
+
pltr functions query get myQuery --version 1.0.0
|
|
118
|
+
|
|
119
|
+
# Output as JSON
|
|
120
|
+
pltr functions query get myQuery --format json
|
|
121
|
+
|
|
122
|
+
# Enable preview mode
|
|
123
|
+
pltr functions query get myQuery --preview
|
|
124
|
+
"""
|
|
125
|
+
try:
|
|
126
|
+
service = FunctionsService(profile=profile)
|
|
127
|
+
|
|
128
|
+
with SpinnerProgressTracker().track_spinner(
|
|
129
|
+
f"Fetching query '{query_api_name}'..."
|
|
130
|
+
):
|
|
131
|
+
query = service.get_query(query_api_name, preview=preview, version=version)
|
|
132
|
+
|
|
133
|
+
if output:
|
|
134
|
+
formatter.save_to_file(query, output, format)
|
|
135
|
+
formatter.print_success(f"Query information saved to {output}")
|
|
136
|
+
else:
|
|
137
|
+
formatter.display(query, format)
|
|
138
|
+
|
|
139
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
140
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
141
|
+
raise typer.Exit(1)
|
|
142
|
+
except ValueError as e:
|
|
143
|
+
formatter.print_error(f"Invalid request: {e}")
|
|
144
|
+
raise typer.Exit(1)
|
|
145
|
+
except Exception as e:
|
|
146
|
+
formatter.print_error(f"Failed to get query: {e}")
|
|
147
|
+
raise typer.Exit(1)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@query_app.command("get-by-rid")
|
|
151
|
+
def get_query_by_rid(
|
|
152
|
+
query_rid: str = typer.Argument(
|
|
153
|
+
...,
|
|
154
|
+
help="Query Resource Identifier (e.g., ri.functions.main.query.abc123)",
|
|
155
|
+
autocompletion=complete_rid,
|
|
156
|
+
),
|
|
157
|
+
version: Optional[str] = typer.Option(
|
|
158
|
+
None,
|
|
159
|
+
"--version",
|
|
160
|
+
"-v",
|
|
161
|
+
help="Query version to retrieve (e.g., '1.0.0'). Defaults to latest.",
|
|
162
|
+
),
|
|
163
|
+
profile: Optional[str] = typer.Option(
|
|
164
|
+
None,
|
|
165
|
+
"--profile",
|
|
166
|
+
"-p",
|
|
167
|
+
help="Profile name",
|
|
168
|
+
autocompletion=complete_profile,
|
|
169
|
+
),
|
|
170
|
+
format: str = typer.Option(
|
|
171
|
+
"table",
|
|
172
|
+
"--format",
|
|
173
|
+
"-f",
|
|
174
|
+
help="Output format (table, json, csv)",
|
|
175
|
+
autocompletion=complete_output_format,
|
|
176
|
+
),
|
|
177
|
+
output: Optional[str] = typer.Option(
|
|
178
|
+
None, "--output", "-o", help="Output file path"
|
|
179
|
+
),
|
|
180
|
+
preview: bool = typer.Option(
|
|
181
|
+
False,
|
|
182
|
+
"--preview",
|
|
183
|
+
help="Enable preview mode",
|
|
184
|
+
),
|
|
185
|
+
):
|
|
186
|
+
"""
|
|
187
|
+
Get query metadata by RID.
|
|
188
|
+
|
|
189
|
+
Retrieves query configuration including parameters, output structure,
|
|
190
|
+
and version information.
|
|
191
|
+
|
|
192
|
+
Examples:
|
|
193
|
+
|
|
194
|
+
# Get query by RID
|
|
195
|
+
pltr functions query get-by-rid ri.functions.main.query.abc123
|
|
196
|
+
|
|
197
|
+
# Get specific version
|
|
198
|
+
pltr functions query get-by-rid ri.functions.main.query.abc123 --version 1.0.0
|
|
199
|
+
|
|
200
|
+
# Output as JSON
|
|
201
|
+
pltr functions query get-by-rid ri.functions.main.query.abc123 --format json
|
|
202
|
+
"""
|
|
203
|
+
try:
|
|
204
|
+
cache_rid(query_rid)
|
|
205
|
+
|
|
206
|
+
service = FunctionsService(profile=profile)
|
|
207
|
+
|
|
208
|
+
with SpinnerProgressTracker().track_spinner(f"Fetching query {query_rid}..."):
|
|
209
|
+
query = service.get_query_by_rid(
|
|
210
|
+
query_rid, preview=preview, version=version
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
if output:
|
|
214
|
+
formatter.save_to_file(query, output, format)
|
|
215
|
+
formatter.print_success(f"Query information saved to {output}")
|
|
216
|
+
else:
|
|
217
|
+
formatter.display(query, format)
|
|
218
|
+
|
|
219
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
220
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
221
|
+
raise typer.Exit(1)
|
|
222
|
+
except ValueError as e:
|
|
223
|
+
formatter.print_error(f"Invalid request: {e}")
|
|
224
|
+
raise typer.Exit(1)
|
|
225
|
+
except Exception as e:
|
|
226
|
+
formatter.print_error(f"Failed to get query: {e}")
|
|
227
|
+
raise typer.Exit(1)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@query_app.command("execute")
|
|
231
|
+
def execute_query(
|
|
232
|
+
query_api_name: str = typer.Argument(
|
|
233
|
+
...,
|
|
234
|
+
help="Query API name (e.g., myQuery)",
|
|
235
|
+
),
|
|
236
|
+
parameters: Optional[str] = typer.Option(
|
|
237
|
+
None,
|
|
238
|
+
"--parameters",
|
|
239
|
+
"-params",
|
|
240
|
+
help="Query parameters as JSON string or @file.json",
|
|
241
|
+
),
|
|
242
|
+
version: Optional[str] = typer.Option(
|
|
243
|
+
None,
|
|
244
|
+
"--version",
|
|
245
|
+
"-v",
|
|
246
|
+
help="Query version to execute (e.g., '1.0.0'). Defaults to latest.",
|
|
247
|
+
),
|
|
248
|
+
profile: Optional[str] = typer.Option(
|
|
249
|
+
None,
|
|
250
|
+
"--profile",
|
|
251
|
+
"-p",
|
|
252
|
+
help="Profile name",
|
|
253
|
+
autocompletion=complete_profile,
|
|
254
|
+
),
|
|
255
|
+
format: str = typer.Option(
|
|
256
|
+
"table",
|
|
257
|
+
"--format",
|
|
258
|
+
"-f",
|
|
259
|
+
help="Output format (table, json, csv)",
|
|
260
|
+
autocompletion=complete_output_format,
|
|
261
|
+
),
|
|
262
|
+
output: Optional[str] = typer.Option(
|
|
263
|
+
None, "--output", "-o", help="Output file path"
|
|
264
|
+
),
|
|
265
|
+
preview: bool = typer.Option(
|
|
266
|
+
False,
|
|
267
|
+
"--preview",
|
|
268
|
+
help="Enable preview mode",
|
|
269
|
+
),
|
|
270
|
+
):
|
|
271
|
+
"""
|
|
272
|
+
Execute a query by API name with parameters.
|
|
273
|
+
|
|
274
|
+
Parameters can be provided as inline JSON or loaded from a file.
|
|
275
|
+
Supports complex data types including primitives, arrays, structs,
|
|
276
|
+
dates, and timestamps.
|
|
277
|
+
|
|
278
|
+
Examples:
|
|
279
|
+
|
|
280
|
+
# Execute with inline parameters
|
|
281
|
+
pltr functions query execute myQuery --parameters '{"limit": 10}'
|
|
282
|
+
|
|
283
|
+
# Execute with parameters from file
|
|
284
|
+
pltr functions query execute myQuery --parameters @params.json
|
|
285
|
+
|
|
286
|
+
# Execute with complex parameters
|
|
287
|
+
pltr functions query execute myQuery --parameters '{
|
|
288
|
+
"limit": 100,
|
|
289
|
+
"filter": "active",
|
|
290
|
+
"config": {"enabled": true}
|
|
291
|
+
}'
|
|
292
|
+
|
|
293
|
+
# Execute specific version
|
|
294
|
+
pltr functions query execute myQuery --version 1.0.0 --parameters '{}'
|
|
295
|
+
|
|
296
|
+
# Execute with preview mode
|
|
297
|
+
pltr functions query execute myQuery --preview --parameters '{}'
|
|
298
|
+
"""
|
|
299
|
+
try:
|
|
300
|
+
# Parse parameters
|
|
301
|
+
try:
|
|
302
|
+
params = parse_parameters(parameters)
|
|
303
|
+
except FileNotFoundError as e:
|
|
304
|
+
formatter.print_error(str(e))
|
|
305
|
+
raise typer.Exit(1)
|
|
306
|
+
except json.JSONDecodeError as e:
|
|
307
|
+
formatter.print_error(f"Invalid JSON in parameters: {e}")
|
|
308
|
+
raise typer.Exit(1)
|
|
309
|
+
|
|
310
|
+
service = FunctionsService(profile=profile)
|
|
311
|
+
|
|
312
|
+
with SpinnerProgressTracker().track_spinner(
|
|
313
|
+
f"Executing query '{query_api_name}'..."
|
|
314
|
+
):
|
|
315
|
+
result = service.execute_query(
|
|
316
|
+
query_api_name, parameters=params, preview=preview, version=version
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
if output:
|
|
320
|
+
formatter.save_to_file(result, output, format)
|
|
321
|
+
formatter.print_success(f"Query result saved to {output}")
|
|
322
|
+
else:
|
|
323
|
+
formatter.display(result, format)
|
|
324
|
+
|
|
325
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
326
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
327
|
+
raise typer.Exit(1)
|
|
328
|
+
except ValueError as e:
|
|
329
|
+
formatter.print_error(f"Invalid request: {e}")
|
|
330
|
+
raise typer.Exit(1)
|
|
331
|
+
except Exception as e:
|
|
332
|
+
formatter.print_error(f"Failed to execute query: {e}")
|
|
333
|
+
raise typer.Exit(1)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
@query_app.command("execute-by-rid")
|
|
337
|
+
def execute_query_by_rid(
|
|
338
|
+
query_rid: str = typer.Argument(
|
|
339
|
+
...,
|
|
340
|
+
help="Query Resource Identifier (e.g., ri.functions.main.query.abc123)",
|
|
341
|
+
autocompletion=complete_rid,
|
|
342
|
+
),
|
|
343
|
+
parameters: Optional[str] = typer.Option(
|
|
344
|
+
None,
|
|
345
|
+
"--parameters",
|
|
346
|
+
"-params",
|
|
347
|
+
help="Query parameters as JSON string or @file.json",
|
|
348
|
+
),
|
|
349
|
+
version: Optional[str] = typer.Option(
|
|
350
|
+
None,
|
|
351
|
+
"--version",
|
|
352
|
+
"-v",
|
|
353
|
+
help="Query version to execute (e.g., '1.0.0'). Defaults to latest.",
|
|
354
|
+
),
|
|
355
|
+
profile: Optional[str] = typer.Option(
|
|
356
|
+
None,
|
|
357
|
+
"--profile",
|
|
358
|
+
"-p",
|
|
359
|
+
help="Profile name",
|
|
360
|
+
autocompletion=complete_profile,
|
|
361
|
+
),
|
|
362
|
+
format: str = typer.Option(
|
|
363
|
+
"table",
|
|
364
|
+
"--format",
|
|
365
|
+
"-f",
|
|
366
|
+
help="Output format (table, json, csv)",
|
|
367
|
+
autocompletion=complete_output_format,
|
|
368
|
+
),
|
|
369
|
+
output: Optional[str] = typer.Option(
|
|
370
|
+
None, "--output", "-o", help="Output file path"
|
|
371
|
+
),
|
|
372
|
+
preview: bool = typer.Option(
|
|
373
|
+
False,
|
|
374
|
+
"--preview",
|
|
375
|
+
help="Enable preview mode",
|
|
376
|
+
),
|
|
377
|
+
):
|
|
378
|
+
"""
|
|
379
|
+
Execute a query by RID with parameters.
|
|
380
|
+
|
|
381
|
+
Parameters can be provided as inline JSON or loaded from a file.
|
|
382
|
+
Supports complex data types including primitives, arrays, structs,
|
|
383
|
+
dates, and timestamps.
|
|
384
|
+
|
|
385
|
+
Examples:
|
|
386
|
+
|
|
387
|
+
# Execute with inline parameters
|
|
388
|
+
pltr functions query execute-by-rid ri.functions.main.query.abc123 --parameters '{"limit": 10}'
|
|
389
|
+
|
|
390
|
+
# Execute with parameters from file
|
|
391
|
+
pltr functions query execute-by-rid ri.functions.main.query.abc123 --parameters @params.json
|
|
392
|
+
|
|
393
|
+
# Execute specific version
|
|
394
|
+
pltr functions query execute-by-rid ri.functions.main.query.abc123 --version 1.0.0 --parameters '{}'
|
|
395
|
+
"""
|
|
396
|
+
try:
|
|
397
|
+
cache_rid(query_rid)
|
|
398
|
+
|
|
399
|
+
# Parse parameters
|
|
400
|
+
try:
|
|
401
|
+
params = parse_parameters(parameters)
|
|
402
|
+
except FileNotFoundError as e:
|
|
403
|
+
formatter.print_error(str(e))
|
|
404
|
+
raise typer.Exit(1)
|
|
405
|
+
except json.JSONDecodeError as e:
|
|
406
|
+
formatter.print_error(f"Invalid JSON in parameters: {e}")
|
|
407
|
+
raise typer.Exit(1)
|
|
408
|
+
|
|
409
|
+
service = FunctionsService(profile=profile)
|
|
410
|
+
|
|
411
|
+
with SpinnerProgressTracker().track_spinner(f"Executing query {query_rid}..."):
|
|
412
|
+
result = service.execute_query_by_rid(
|
|
413
|
+
query_rid, parameters=params, preview=preview, version=version
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
if output:
|
|
417
|
+
formatter.save_to_file(result, output, format)
|
|
418
|
+
formatter.print_success(f"Query result saved to {output}")
|
|
419
|
+
else:
|
|
420
|
+
formatter.display(result, format)
|
|
421
|
+
|
|
422
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
423
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
424
|
+
raise typer.Exit(1)
|
|
425
|
+
except ValueError as e:
|
|
426
|
+
formatter.print_error(f"Invalid request: {e}")
|
|
427
|
+
raise typer.Exit(1)
|
|
428
|
+
except Exception as e:
|
|
429
|
+
formatter.print_error(f"Failed to execute query: {e}")
|
|
430
|
+
raise typer.Exit(1)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
@value_type_app.command("get")
|
|
434
|
+
def get_value_type(
|
|
435
|
+
value_type_rid: str = typer.Argument(
|
|
436
|
+
...,
|
|
437
|
+
help="Value Type Resource Identifier (e.g., ri.functions.main.value-type.xyz)",
|
|
438
|
+
autocompletion=complete_rid,
|
|
439
|
+
),
|
|
440
|
+
profile: Optional[str] = typer.Option(
|
|
441
|
+
None,
|
|
442
|
+
"--profile",
|
|
443
|
+
"-p",
|
|
444
|
+
help="Profile name",
|
|
445
|
+
autocompletion=complete_profile,
|
|
446
|
+
),
|
|
447
|
+
format: str = typer.Option(
|
|
448
|
+
"table",
|
|
449
|
+
"--format",
|
|
450
|
+
"-f",
|
|
451
|
+
help="Output format (table, json, csv)",
|
|
452
|
+
autocompletion=complete_output_format,
|
|
453
|
+
),
|
|
454
|
+
output: Optional[str] = typer.Option(
|
|
455
|
+
None, "--output", "-o", help="Output file path"
|
|
456
|
+
),
|
|
457
|
+
preview: bool = typer.Option(
|
|
458
|
+
False,
|
|
459
|
+
"--preview",
|
|
460
|
+
help="Enable preview mode",
|
|
461
|
+
),
|
|
462
|
+
):
|
|
463
|
+
"""
|
|
464
|
+
Get value type details by RID.
|
|
465
|
+
|
|
466
|
+
Retrieves value type definition and structure information.
|
|
467
|
+
|
|
468
|
+
Examples:
|
|
469
|
+
|
|
470
|
+
# Get value type details
|
|
471
|
+
pltr functions value-type get ri.functions.main.value-type.xyz
|
|
472
|
+
|
|
473
|
+
# Output as JSON
|
|
474
|
+
pltr functions value-type get ri.functions.main.value-type.xyz --format json
|
|
475
|
+
|
|
476
|
+
# Enable preview mode
|
|
477
|
+
pltr functions value-type get ri.functions.main.value-type.xyz --preview
|
|
478
|
+
"""
|
|
479
|
+
try:
|
|
480
|
+
cache_rid(value_type_rid)
|
|
481
|
+
|
|
482
|
+
service = FunctionsService(profile=profile)
|
|
483
|
+
|
|
484
|
+
with SpinnerProgressTracker().track_spinner(
|
|
485
|
+
f"Fetching value type {value_type_rid}..."
|
|
486
|
+
):
|
|
487
|
+
value_type = service.get_value_type(value_type_rid, preview=preview)
|
|
488
|
+
|
|
489
|
+
if output:
|
|
490
|
+
formatter.save_to_file(value_type, output, format)
|
|
491
|
+
formatter.print_success(f"Value type information saved to {output}")
|
|
492
|
+
else:
|
|
493
|
+
formatter.display(value_type, format)
|
|
494
|
+
|
|
495
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
496
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
497
|
+
raise typer.Exit(1)
|
|
498
|
+
except ValueError as e:
|
|
499
|
+
formatter.print_error(f"Invalid request: {e}")
|
|
500
|
+
raise typer.Exit(1)
|
|
501
|
+
except Exception as e:
|
|
502
|
+
formatter.print_error(f"Failed to get value type: {e}")
|
|
503
|
+
raise typer.Exit(1)
|