pltr-cli 0.4.0__py3-none-any.whl → 0.5.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/cli.py +8 -0
- pltr/commands/dataset.py +309 -0
- pltr/commands/mediasets.py +422 -0
- pltr/commands/orchestration.py +642 -0
- pltr/services/dataset.py +368 -10
- pltr/services/mediasets.py +293 -0
- pltr/services/orchestration.py +457 -0
- pltr/utils/formatting.py +638 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.0.dist-info}/METADATA +131 -4
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.0.dist-info}/RECORD +13 -11
- pltr/services/dataset_full.py +0 -302
- pltr/services/dataset_v2.py +0 -128
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.0.dist-info}/WHEEL +0 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.0.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.0.dist-info}/licenses/LICENSE +0 -0
pltr/cli.py
CHANGED
|
@@ -12,11 +12,13 @@ from pltr.commands import (
|
|
|
12
12
|
dataset,
|
|
13
13
|
folder,
|
|
14
14
|
ontology,
|
|
15
|
+
orchestration,
|
|
15
16
|
sql,
|
|
16
17
|
admin,
|
|
17
18
|
shell,
|
|
18
19
|
completion,
|
|
19
20
|
alias,
|
|
21
|
+
mediasets,
|
|
20
22
|
)
|
|
21
23
|
|
|
22
24
|
app = typer.Typer(
|
|
@@ -31,7 +33,13 @@ app.add_typer(verify.app, name="verify", help="Verify authentication")
|
|
|
31
33
|
app.add_typer(dataset.app, name="dataset", help="Manage datasets")
|
|
32
34
|
app.add_typer(folder.app, name="folder", help="Manage folders")
|
|
33
35
|
app.add_typer(ontology.app, name="ontology", help="Ontology operations")
|
|
36
|
+
app.add_typer(
|
|
37
|
+
orchestration.app, name="orchestration", help="Manage builds, jobs, and schedules"
|
|
38
|
+
)
|
|
34
39
|
app.add_typer(sql.app, name="sql", help="Execute SQL queries")
|
|
40
|
+
app.add_typer(
|
|
41
|
+
mediasets.app, name="media-sets", help="Manage media sets and media content"
|
|
42
|
+
)
|
|
35
43
|
app.add_typer(
|
|
36
44
|
admin.app,
|
|
37
45
|
name="admin",
|
pltr/commands/dataset.py
CHANGED
|
@@ -18,6 +18,10 @@ from ..utils.completion import (
|
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
app = typer.Typer()
|
|
21
|
+
branches_app = typer.Typer()
|
|
22
|
+
files_app = typer.Typer()
|
|
23
|
+
transactions_app = typer.Typer()
|
|
24
|
+
views_app = typer.Typer()
|
|
21
25
|
console = Console()
|
|
22
26
|
formatter = OutputFormatter(console)
|
|
23
27
|
|
|
@@ -101,6 +105,311 @@ def create_dataset(
|
|
|
101
105
|
raise typer.Exit(1)
|
|
102
106
|
|
|
103
107
|
|
|
108
|
+
# Branch commands
|
|
109
|
+
@branches_app.command("list")
|
|
110
|
+
def list_branches(
|
|
111
|
+
dataset_rid: str = typer.Argument(
|
|
112
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
113
|
+
),
|
|
114
|
+
profile: Optional[str] = typer.Option(
|
|
115
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
116
|
+
),
|
|
117
|
+
format: str = typer.Option(
|
|
118
|
+
"table",
|
|
119
|
+
"--format",
|
|
120
|
+
"-f",
|
|
121
|
+
help="Output format (table, json, csv)",
|
|
122
|
+
autocompletion=complete_output_format,
|
|
123
|
+
),
|
|
124
|
+
output: Optional[str] = typer.Option(
|
|
125
|
+
None, "--output", "-o", help="Output file path"
|
|
126
|
+
),
|
|
127
|
+
):
|
|
128
|
+
"""List branches for a dataset."""
|
|
129
|
+
try:
|
|
130
|
+
cache_rid(dataset_rid)
|
|
131
|
+
service = DatasetService(profile=profile)
|
|
132
|
+
|
|
133
|
+
with SpinnerProgressTracker().track_spinner(
|
|
134
|
+
f"Fetching branches for {dataset_rid}..."
|
|
135
|
+
):
|
|
136
|
+
branches = service.get_branches(dataset_rid)
|
|
137
|
+
|
|
138
|
+
formatter.format_branches(branches, format, output)
|
|
139
|
+
|
|
140
|
+
if output:
|
|
141
|
+
formatter.print_success(f"Branches information saved to {output}")
|
|
142
|
+
|
|
143
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
144
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
145
|
+
raise typer.Exit(1)
|
|
146
|
+
except Exception as e:
|
|
147
|
+
formatter.print_error(f"Failed to get branches: {e}")
|
|
148
|
+
raise typer.Exit(1)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@branches_app.command("create")
|
|
152
|
+
def create_branch(
|
|
153
|
+
dataset_rid: str = typer.Argument(
|
|
154
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
155
|
+
),
|
|
156
|
+
branch_name: str = typer.Argument(..., help="Branch name"),
|
|
157
|
+
parent_branch: str = typer.Option(
|
|
158
|
+
"master", "--parent", help="Parent branch to branch from"
|
|
159
|
+
),
|
|
160
|
+
profile: Optional[str] = typer.Option(
|
|
161
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
162
|
+
),
|
|
163
|
+
format: str = typer.Option(
|
|
164
|
+
"table",
|
|
165
|
+
"--format",
|
|
166
|
+
"-f",
|
|
167
|
+
help="Output format (table, json, csv)",
|
|
168
|
+
autocompletion=complete_output_format,
|
|
169
|
+
),
|
|
170
|
+
):
|
|
171
|
+
"""Create a new branch for a dataset."""
|
|
172
|
+
try:
|
|
173
|
+
cache_rid(dataset_rid)
|
|
174
|
+
service = DatasetService(profile=profile)
|
|
175
|
+
|
|
176
|
+
with SpinnerProgressTracker().track_spinner(
|
|
177
|
+
f"Creating branch '{branch_name}' from '{parent_branch}'..."
|
|
178
|
+
):
|
|
179
|
+
branch = service.create_branch(dataset_rid, branch_name, parent_branch)
|
|
180
|
+
|
|
181
|
+
formatter.print_success(f"Successfully created branch '{branch_name}'")
|
|
182
|
+
formatter.format_branch_detail(branch, format)
|
|
183
|
+
|
|
184
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
185
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
186
|
+
raise typer.Exit(1)
|
|
187
|
+
except Exception as e:
|
|
188
|
+
formatter.print_error(f"Failed to create branch: {e}")
|
|
189
|
+
raise typer.Exit(1)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# Files commands
|
|
193
|
+
@files_app.command("list")
|
|
194
|
+
def list_files(
|
|
195
|
+
dataset_rid: str = typer.Argument(
|
|
196
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
197
|
+
),
|
|
198
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
199
|
+
profile: Optional[str] = typer.Option(
|
|
200
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
201
|
+
),
|
|
202
|
+
format: str = typer.Option(
|
|
203
|
+
"table",
|
|
204
|
+
"--format",
|
|
205
|
+
"-f",
|
|
206
|
+
help="Output format (table, json, csv)",
|
|
207
|
+
autocompletion=complete_output_format,
|
|
208
|
+
),
|
|
209
|
+
output: Optional[str] = typer.Option(
|
|
210
|
+
None, "--output", "-o", help="Output file path"
|
|
211
|
+
),
|
|
212
|
+
):
|
|
213
|
+
"""List files in a dataset."""
|
|
214
|
+
try:
|
|
215
|
+
cache_rid(dataset_rid)
|
|
216
|
+
service = DatasetService(profile=profile)
|
|
217
|
+
|
|
218
|
+
with SpinnerProgressTracker().track_spinner(
|
|
219
|
+
f"Fetching files from {dataset_rid} (branch: {branch})..."
|
|
220
|
+
):
|
|
221
|
+
files = service.list_files(dataset_rid, branch)
|
|
222
|
+
|
|
223
|
+
formatter.format_files(files, format, output)
|
|
224
|
+
|
|
225
|
+
if output:
|
|
226
|
+
formatter.print_success(f"Files information saved to {output}")
|
|
227
|
+
|
|
228
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
229
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
230
|
+
raise typer.Exit(1)
|
|
231
|
+
except Exception as e:
|
|
232
|
+
formatter.print_error(f"Failed to list files: {e}")
|
|
233
|
+
raise typer.Exit(1)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@files_app.command("get")
|
|
237
|
+
def get_file(
|
|
238
|
+
dataset_rid: str = typer.Argument(
|
|
239
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
240
|
+
),
|
|
241
|
+
file_path: str = typer.Argument(..., help="Path of file within dataset"),
|
|
242
|
+
output_path: str = typer.Argument(..., help="Local path to save the file"),
|
|
243
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
244
|
+
profile: Optional[str] = typer.Option(
|
|
245
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
246
|
+
),
|
|
247
|
+
):
|
|
248
|
+
"""Download a file from a dataset."""
|
|
249
|
+
try:
|
|
250
|
+
cache_rid(dataset_rid)
|
|
251
|
+
service = DatasetService(profile=profile)
|
|
252
|
+
|
|
253
|
+
with SpinnerProgressTracker().track_spinner(
|
|
254
|
+
f"Downloading {file_path} from {dataset_rid}..."
|
|
255
|
+
):
|
|
256
|
+
result = service.download_file(dataset_rid, file_path, output_path, branch)
|
|
257
|
+
|
|
258
|
+
formatter.print_success(f"File downloaded to {result['output_path']}")
|
|
259
|
+
formatter.print_info(f"Size: {result.get('size_bytes', 'unknown')} bytes")
|
|
260
|
+
|
|
261
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
262
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
263
|
+
raise typer.Exit(1)
|
|
264
|
+
except Exception as e:
|
|
265
|
+
formatter.print_error(f"Failed to download file: {e}")
|
|
266
|
+
raise typer.Exit(1)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# Transaction commands
|
|
270
|
+
@transactions_app.command("list")
|
|
271
|
+
def list_transactions(
|
|
272
|
+
dataset_rid: str = typer.Argument(
|
|
273
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
274
|
+
),
|
|
275
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
276
|
+
profile: Optional[str] = typer.Option(
|
|
277
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
278
|
+
),
|
|
279
|
+
format: str = typer.Option(
|
|
280
|
+
"table",
|
|
281
|
+
"--format",
|
|
282
|
+
"-f",
|
|
283
|
+
help="Output format (table, json, csv)",
|
|
284
|
+
autocompletion=complete_output_format,
|
|
285
|
+
),
|
|
286
|
+
output: Optional[str] = typer.Option(
|
|
287
|
+
None, "--output", "-o", help="Output file path"
|
|
288
|
+
),
|
|
289
|
+
):
|
|
290
|
+
"""List transactions for a dataset branch."""
|
|
291
|
+
try:
|
|
292
|
+
cache_rid(dataset_rid)
|
|
293
|
+
service = DatasetService(profile=profile)
|
|
294
|
+
|
|
295
|
+
with SpinnerProgressTracker().track_spinner(
|
|
296
|
+
f"Fetching transactions for {dataset_rid} (branch: {branch})..."
|
|
297
|
+
):
|
|
298
|
+
transactions = service.get_transactions(dataset_rid, branch)
|
|
299
|
+
|
|
300
|
+
formatter.format_transactions(transactions, format, output)
|
|
301
|
+
|
|
302
|
+
if output:
|
|
303
|
+
formatter.print_success(f"Transactions information saved to {output}")
|
|
304
|
+
|
|
305
|
+
except NotImplementedError as e:
|
|
306
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
307
|
+
raise typer.Exit(0)
|
|
308
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
309
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
310
|
+
raise typer.Exit(1)
|
|
311
|
+
except Exception as e:
|
|
312
|
+
formatter.print_error(f"Failed to list transactions: {e}")
|
|
313
|
+
raise typer.Exit(1)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
# Views commands
|
|
317
|
+
@views_app.command("list")
|
|
318
|
+
def list_views(
|
|
319
|
+
dataset_rid: str = typer.Argument(
|
|
320
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
321
|
+
),
|
|
322
|
+
profile: Optional[str] = typer.Option(
|
|
323
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
324
|
+
),
|
|
325
|
+
format: str = typer.Option(
|
|
326
|
+
"table",
|
|
327
|
+
"--format",
|
|
328
|
+
"-f",
|
|
329
|
+
help="Output format (table, json, csv)",
|
|
330
|
+
autocompletion=complete_output_format,
|
|
331
|
+
),
|
|
332
|
+
output: Optional[str] = typer.Option(
|
|
333
|
+
None, "--output", "-o", help="Output file path"
|
|
334
|
+
),
|
|
335
|
+
):
|
|
336
|
+
"""List views for a dataset."""
|
|
337
|
+
try:
|
|
338
|
+
cache_rid(dataset_rid)
|
|
339
|
+
service = DatasetService(profile=profile)
|
|
340
|
+
|
|
341
|
+
with SpinnerProgressTracker().track_spinner(
|
|
342
|
+
f"Fetching views for {dataset_rid}..."
|
|
343
|
+
):
|
|
344
|
+
views = service.get_views(dataset_rid)
|
|
345
|
+
|
|
346
|
+
formatter.format_views(views, format, output)
|
|
347
|
+
|
|
348
|
+
if output:
|
|
349
|
+
formatter.print_success(f"Views information saved to {output}")
|
|
350
|
+
|
|
351
|
+
except NotImplementedError as e:
|
|
352
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
353
|
+
raise typer.Exit(0)
|
|
354
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
355
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
356
|
+
raise typer.Exit(1)
|
|
357
|
+
except Exception as e:
|
|
358
|
+
formatter.print_error(f"Failed to list views: {e}")
|
|
359
|
+
raise typer.Exit(1)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
@views_app.command("create")
|
|
363
|
+
def create_view(
|
|
364
|
+
dataset_rid: str = typer.Argument(
|
|
365
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
366
|
+
),
|
|
367
|
+
view_name: str = typer.Argument(..., help="View name"),
|
|
368
|
+
description: Optional[str] = typer.Option(
|
|
369
|
+
None, "--description", help="View description"
|
|
370
|
+
),
|
|
371
|
+
profile: Optional[str] = typer.Option(
|
|
372
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
373
|
+
),
|
|
374
|
+
format: str = typer.Option(
|
|
375
|
+
"table",
|
|
376
|
+
"--format",
|
|
377
|
+
"-f",
|
|
378
|
+
help="Output format (table, json, csv)",
|
|
379
|
+
autocompletion=complete_output_format,
|
|
380
|
+
),
|
|
381
|
+
):
|
|
382
|
+
"""Create a new view for a dataset."""
|
|
383
|
+
try:
|
|
384
|
+
cache_rid(dataset_rid)
|
|
385
|
+
service = DatasetService(profile=profile)
|
|
386
|
+
|
|
387
|
+
with SpinnerProgressTracker().track_spinner(
|
|
388
|
+
f"Creating view '{view_name}' for {dataset_rid}..."
|
|
389
|
+
):
|
|
390
|
+
view = service.create_view(dataset_rid, view_name, description)
|
|
391
|
+
|
|
392
|
+
formatter.print_success(f"Successfully created view '{view_name}'")
|
|
393
|
+
formatter.format_view_detail(view, format)
|
|
394
|
+
|
|
395
|
+
except NotImplementedError as e:
|
|
396
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
397
|
+
raise typer.Exit(0)
|
|
398
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
399
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
400
|
+
raise typer.Exit(1)
|
|
401
|
+
except Exception as e:
|
|
402
|
+
formatter.print_error(f"Failed to create view: {e}")
|
|
403
|
+
raise typer.Exit(1)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
# Add subcommands to main app
|
|
407
|
+
app.add_typer(branches_app, name="branches")
|
|
408
|
+
app.add_typer(files_app, name="files")
|
|
409
|
+
app.add_typer(transactions_app, name="transactions")
|
|
410
|
+
app.add_typer(views_app, name="views")
|
|
411
|
+
|
|
412
|
+
|
|
104
413
|
@app.callback()
|
|
105
414
|
def main():
|
|
106
415
|
"""
|