pltr-cli 0.4.0__py3-none-any.whl → 0.5.1__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 +22 -0
- pltr/commands/connectivity.py +432 -0
- pltr/commands/dataset.py +577 -0
- pltr/commands/mediasets.py +422 -0
- pltr/commands/orchestration.py +642 -0
- pltr/commands/project.py +440 -0
- pltr/commands/resource.py +499 -0
- pltr/commands/resource_role.py +454 -0
- pltr/commands/space.py +662 -0
- pltr/services/connectivity.py +305 -0
- pltr/services/dataset.py +603 -10
- pltr/services/mediasets.py +293 -0
- pltr/services/orchestration.py +457 -0
- pltr/services/project.py +232 -0
- pltr/services/resource.py +289 -0
- pltr/services/resource_role.py +321 -0
- pltr/services/space.py +354 -0
- pltr/utils/formatting.py +745 -0
- pltr_cli-0.5.1.dist-info/METADATA +513 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.1.dist-info}/RECORD +24 -12
- pltr/services/dataset_full.py +0 -302
- pltr/services/dataset_v2.py +0 -128
- pltr_cli-0.4.0.dist-info/METADATA +0 -287
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.1.dist-info}/WHEEL +0 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.1.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.4.0.dist-info → pltr_cli-0.5.1.dist-info}/licenses/LICENSE +0 -0
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,579 @@ 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("upload")
|
|
237
|
+
def upload_file(
|
|
238
|
+
file_path: str = typer.Argument(..., help="Local path to file to upload"),
|
|
239
|
+
dataset_rid: str = typer.Argument(
|
|
240
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
241
|
+
),
|
|
242
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
243
|
+
transaction_rid: Optional[str] = typer.Option(
|
|
244
|
+
None, "--transaction-rid", help="Transaction RID for the upload"
|
|
245
|
+
),
|
|
246
|
+
profile: Optional[str] = typer.Option(
|
|
247
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
248
|
+
),
|
|
249
|
+
):
|
|
250
|
+
"""Upload a file to a dataset."""
|
|
251
|
+
try:
|
|
252
|
+
cache_rid(dataset_rid)
|
|
253
|
+
service = DatasetService(profile=profile)
|
|
254
|
+
|
|
255
|
+
# Check if file exists
|
|
256
|
+
from pathlib import Path
|
|
257
|
+
|
|
258
|
+
file_path_obj = Path(file_path)
|
|
259
|
+
if not file_path_obj.exists():
|
|
260
|
+
formatter.print_error(f"File not found: {file_path}")
|
|
261
|
+
raise typer.Exit(1)
|
|
262
|
+
|
|
263
|
+
with SpinnerProgressTracker().track_spinner(
|
|
264
|
+
f"Uploading {file_path_obj.name} to {dataset_rid}..."
|
|
265
|
+
):
|
|
266
|
+
result = service.upload_file(
|
|
267
|
+
dataset_rid, file_path, branch, transaction_rid
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
formatter.print_success("File uploaded successfully")
|
|
271
|
+
formatter.print_info(f"File: {result.get('file_path', file_path)}")
|
|
272
|
+
formatter.print_info(f"Dataset: {dataset_rid}")
|
|
273
|
+
formatter.print_info(f"Branch: {branch}")
|
|
274
|
+
formatter.print_info(f"Size: {result.get('size_bytes', 'unknown')} bytes")
|
|
275
|
+
|
|
276
|
+
if result.get("transaction_rid"):
|
|
277
|
+
formatter.print_info(f"Transaction: {result['transaction_rid']}")
|
|
278
|
+
formatter.print_warning(
|
|
279
|
+
"Remember to commit the transaction to make changes permanent"
|
|
280
|
+
)
|
|
281
|
+
|
|
282
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
283
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
284
|
+
raise typer.Exit(1)
|
|
285
|
+
except Exception as e:
|
|
286
|
+
formatter.print_error(f"Failed to upload file: {e}")
|
|
287
|
+
raise typer.Exit(1)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@files_app.command("get")
|
|
291
|
+
def get_file(
|
|
292
|
+
dataset_rid: str = typer.Argument(
|
|
293
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
294
|
+
),
|
|
295
|
+
file_path: str = typer.Argument(..., help="Path of file within dataset"),
|
|
296
|
+
output_path: str = typer.Argument(..., help="Local path to save the file"),
|
|
297
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
298
|
+
profile: Optional[str] = typer.Option(
|
|
299
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
300
|
+
),
|
|
301
|
+
):
|
|
302
|
+
"""Download a file from a dataset."""
|
|
303
|
+
try:
|
|
304
|
+
cache_rid(dataset_rid)
|
|
305
|
+
service = DatasetService(profile=profile)
|
|
306
|
+
|
|
307
|
+
with SpinnerProgressTracker().track_spinner(
|
|
308
|
+
f"Downloading {file_path} from {dataset_rid}..."
|
|
309
|
+
):
|
|
310
|
+
result = service.download_file(dataset_rid, file_path, output_path, branch)
|
|
311
|
+
|
|
312
|
+
formatter.print_success(f"File downloaded to {result['output_path']}")
|
|
313
|
+
formatter.print_info(f"Size: {result.get('size_bytes', 'unknown')} bytes")
|
|
314
|
+
|
|
315
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
316
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
317
|
+
raise typer.Exit(1)
|
|
318
|
+
except Exception as e:
|
|
319
|
+
formatter.print_error(f"Failed to download file: {e}")
|
|
320
|
+
raise typer.Exit(1)
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
# Transaction commands
|
|
324
|
+
@transactions_app.command("start")
|
|
325
|
+
def start_transaction(
|
|
326
|
+
dataset_rid: str = typer.Argument(
|
|
327
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
328
|
+
),
|
|
329
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
330
|
+
transaction_type: str = typer.Option(
|
|
331
|
+
"APPEND", "--type", help="Transaction type (APPEND, UPDATE, SNAPSHOT, DELETE)"
|
|
332
|
+
),
|
|
333
|
+
profile: Optional[str] = typer.Option(
|
|
334
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
335
|
+
),
|
|
336
|
+
format: str = typer.Option(
|
|
337
|
+
"table",
|
|
338
|
+
"--format",
|
|
339
|
+
"-f",
|
|
340
|
+
help="Output format (table, json, csv)",
|
|
341
|
+
autocompletion=complete_output_format,
|
|
342
|
+
),
|
|
343
|
+
):
|
|
344
|
+
"""Start a new transaction for a dataset."""
|
|
345
|
+
try:
|
|
346
|
+
cache_rid(dataset_rid)
|
|
347
|
+
service = DatasetService(profile=profile)
|
|
348
|
+
|
|
349
|
+
# Validate transaction type
|
|
350
|
+
valid_types = ["APPEND", "UPDATE", "SNAPSHOT", "DELETE"]
|
|
351
|
+
if transaction_type not in valid_types:
|
|
352
|
+
formatter.print_error(
|
|
353
|
+
f"Invalid transaction type. Must be one of: {', '.join(valid_types)}"
|
|
354
|
+
)
|
|
355
|
+
raise typer.Exit(1)
|
|
356
|
+
|
|
357
|
+
with SpinnerProgressTracker().track_spinner(
|
|
358
|
+
f"Starting {transaction_type} transaction for {dataset_rid} (branch: {branch})..."
|
|
359
|
+
):
|
|
360
|
+
transaction = service.create_transaction(
|
|
361
|
+
dataset_rid, branch, transaction_type
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
formatter.print_success("Transaction started successfully")
|
|
365
|
+
formatter.print_info(
|
|
366
|
+
f"Transaction RID: {transaction.get('transaction_rid', 'unknown')}"
|
|
367
|
+
)
|
|
368
|
+
formatter.print_info(f"Status: {transaction.get('status', 'OPEN')}")
|
|
369
|
+
formatter.print_info(
|
|
370
|
+
f"Type: {transaction.get('transaction_type', transaction_type)}"
|
|
371
|
+
)
|
|
372
|
+
|
|
373
|
+
# Show transaction details
|
|
374
|
+
formatter.format_transaction_detail(transaction, format)
|
|
375
|
+
|
|
376
|
+
# Show usage hint
|
|
377
|
+
transaction_rid = transaction.get("transaction_rid", "unknown")
|
|
378
|
+
if transaction_rid != "unknown":
|
|
379
|
+
formatter.print_info("\nNext steps:")
|
|
380
|
+
formatter.print_info(
|
|
381
|
+
f" Upload files: pltr dataset files upload <file-path> {dataset_rid} --transaction-rid {transaction_rid}"
|
|
382
|
+
)
|
|
383
|
+
formatter.print_info(
|
|
384
|
+
f" Commit: pltr dataset transactions commit {dataset_rid} {transaction_rid}"
|
|
385
|
+
)
|
|
386
|
+
formatter.print_info(
|
|
387
|
+
f" Abort: pltr dataset transactions abort {dataset_rid} {transaction_rid}"
|
|
388
|
+
)
|
|
389
|
+
|
|
390
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
391
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
392
|
+
raise typer.Exit(1)
|
|
393
|
+
except Exception as e:
|
|
394
|
+
formatter.print_error(f"Failed to start transaction: {e}")
|
|
395
|
+
raise typer.Exit(1)
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
@transactions_app.command("commit")
|
|
399
|
+
def commit_transaction(
|
|
400
|
+
dataset_rid: str = typer.Argument(
|
|
401
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
402
|
+
),
|
|
403
|
+
transaction_rid: str = typer.Argument(..., help="Transaction Resource Identifier"),
|
|
404
|
+
profile: Optional[str] = typer.Option(
|
|
405
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
406
|
+
),
|
|
407
|
+
format: str = typer.Option(
|
|
408
|
+
"table",
|
|
409
|
+
"--format",
|
|
410
|
+
"-f",
|
|
411
|
+
help="Output format (table, json, csv)",
|
|
412
|
+
autocompletion=complete_output_format,
|
|
413
|
+
),
|
|
414
|
+
):
|
|
415
|
+
"""Commit an open transaction."""
|
|
416
|
+
try:
|
|
417
|
+
cache_rid(dataset_rid)
|
|
418
|
+
service = DatasetService(profile=profile)
|
|
419
|
+
|
|
420
|
+
with SpinnerProgressTracker().track_spinner(
|
|
421
|
+
f"Committing transaction {transaction_rid}..."
|
|
422
|
+
):
|
|
423
|
+
result = service.commit_transaction(dataset_rid, transaction_rid)
|
|
424
|
+
|
|
425
|
+
formatter.print_success("Transaction committed successfully")
|
|
426
|
+
formatter.print_info(f"Transaction RID: {transaction_rid}")
|
|
427
|
+
formatter.print_info(f"Dataset RID: {dataset_rid}")
|
|
428
|
+
formatter.print_info(f"Status: {result.get('status', 'COMMITTED')}")
|
|
429
|
+
|
|
430
|
+
# Show result details
|
|
431
|
+
formatter.format_transaction_result(result, format)
|
|
432
|
+
|
|
433
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
434
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
435
|
+
raise typer.Exit(1)
|
|
436
|
+
except Exception as e:
|
|
437
|
+
formatter.print_error(f"Failed to commit transaction: {e}")
|
|
438
|
+
raise typer.Exit(1)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
@transactions_app.command("abort")
|
|
442
|
+
def abort_transaction(
|
|
443
|
+
dataset_rid: str = typer.Argument(
|
|
444
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
445
|
+
),
|
|
446
|
+
transaction_rid: str = typer.Argument(..., help="Transaction Resource Identifier"),
|
|
447
|
+
confirm: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation prompt"),
|
|
448
|
+
profile: Optional[str] = typer.Option(
|
|
449
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
450
|
+
),
|
|
451
|
+
format: str = typer.Option(
|
|
452
|
+
"table",
|
|
453
|
+
"--format",
|
|
454
|
+
"-f",
|
|
455
|
+
help="Output format (table, json, csv)",
|
|
456
|
+
autocompletion=complete_output_format,
|
|
457
|
+
),
|
|
458
|
+
):
|
|
459
|
+
"""Abort an open transaction."""
|
|
460
|
+
try:
|
|
461
|
+
cache_rid(dataset_rid)
|
|
462
|
+
service = DatasetService(profile=profile)
|
|
463
|
+
|
|
464
|
+
# Confirmation prompt
|
|
465
|
+
if not confirm:
|
|
466
|
+
confirmed = typer.confirm(
|
|
467
|
+
f"Are you sure you want to abort transaction {transaction_rid}? "
|
|
468
|
+
f"This will discard all changes made in this transaction."
|
|
469
|
+
)
|
|
470
|
+
if not confirmed:
|
|
471
|
+
formatter.print_info("Transaction abort cancelled")
|
|
472
|
+
raise typer.Exit(0)
|
|
473
|
+
|
|
474
|
+
with SpinnerProgressTracker().track_spinner(
|
|
475
|
+
f"Aborting transaction {transaction_rid}..."
|
|
476
|
+
):
|
|
477
|
+
result = service.abort_transaction(dataset_rid, transaction_rid)
|
|
478
|
+
|
|
479
|
+
formatter.print_success("Transaction aborted successfully")
|
|
480
|
+
formatter.print_info(f"Transaction RID: {transaction_rid}")
|
|
481
|
+
formatter.print_info(f"Dataset RID: {dataset_rid}")
|
|
482
|
+
formatter.print_info(f"Status: {result.get('status', 'ABORTED')}")
|
|
483
|
+
formatter.print_warning(
|
|
484
|
+
"All changes made in this transaction have been discarded"
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
# Show result details
|
|
488
|
+
formatter.format_transaction_result(result, format)
|
|
489
|
+
|
|
490
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
491
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
492
|
+
raise typer.Exit(1)
|
|
493
|
+
except Exception as e:
|
|
494
|
+
formatter.print_error(f"Failed to abort transaction: {e}")
|
|
495
|
+
raise typer.Exit(1)
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
@transactions_app.command("status")
|
|
499
|
+
def get_transaction_status(
|
|
500
|
+
dataset_rid: str = typer.Argument(
|
|
501
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
502
|
+
),
|
|
503
|
+
transaction_rid: str = typer.Argument(..., help="Transaction Resource Identifier"),
|
|
504
|
+
profile: Optional[str] = typer.Option(
|
|
505
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
506
|
+
),
|
|
507
|
+
format: str = typer.Option(
|
|
508
|
+
"table",
|
|
509
|
+
"--format",
|
|
510
|
+
"-f",
|
|
511
|
+
help="Output format (table, json, csv)",
|
|
512
|
+
autocompletion=complete_output_format,
|
|
513
|
+
),
|
|
514
|
+
):
|
|
515
|
+
"""Get the status of a specific transaction."""
|
|
516
|
+
try:
|
|
517
|
+
cache_rid(dataset_rid)
|
|
518
|
+
service = DatasetService(profile=profile)
|
|
519
|
+
|
|
520
|
+
with SpinnerProgressTracker().track_spinner(
|
|
521
|
+
f"Fetching transaction status for {transaction_rid}..."
|
|
522
|
+
):
|
|
523
|
+
transaction = service.get_transaction_status(dataset_rid, transaction_rid)
|
|
524
|
+
|
|
525
|
+
formatter.print_success("Transaction status retrieved")
|
|
526
|
+
|
|
527
|
+
# Show transaction details
|
|
528
|
+
formatter.format_transaction_detail(transaction, format)
|
|
529
|
+
|
|
530
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
531
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
532
|
+
raise typer.Exit(1)
|
|
533
|
+
except Exception as e:
|
|
534
|
+
formatter.print_error(f"Failed to get transaction status: {e}")
|
|
535
|
+
raise typer.Exit(1)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
@transactions_app.command("list")
|
|
539
|
+
def list_transactions(
|
|
540
|
+
dataset_rid: str = typer.Argument(
|
|
541
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
542
|
+
),
|
|
543
|
+
branch: str = typer.Option("master", "--branch", help="Dataset branch"),
|
|
544
|
+
profile: Optional[str] = typer.Option(
|
|
545
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
546
|
+
),
|
|
547
|
+
format: str = typer.Option(
|
|
548
|
+
"table",
|
|
549
|
+
"--format",
|
|
550
|
+
"-f",
|
|
551
|
+
help="Output format (table, json, csv)",
|
|
552
|
+
autocompletion=complete_output_format,
|
|
553
|
+
),
|
|
554
|
+
output: Optional[str] = typer.Option(
|
|
555
|
+
None, "--output", "-o", help="Output file path"
|
|
556
|
+
),
|
|
557
|
+
):
|
|
558
|
+
"""List transactions for a dataset branch."""
|
|
559
|
+
try:
|
|
560
|
+
cache_rid(dataset_rid)
|
|
561
|
+
service = DatasetService(profile=profile)
|
|
562
|
+
|
|
563
|
+
with SpinnerProgressTracker().track_spinner(
|
|
564
|
+
f"Fetching transactions for {dataset_rid} (branch: {branch})..."
|
|
565
|
+
):
|
|
566
|
+
transactions = service.get_transactions(dataset_rid, branch)
|
|
567
|
+
|
|
568
|
+
formatter.format_transactions(transactions, format, output)
|
|
569
|
+
|
|
570
|
+
if output:
|
|
571
|
+
formatter.print_success(f"Transactions information saved to {output}")
|
|
572
|
+
|
|
573
|
+
except NotImplementedError as e:
|
|
574
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
575
|
+
raise typer.Exit(0)
|
|
576
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
577
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
578
|
+
raise typer.Exit(1)
|
|
579
|
+
except Exception as e:
|
|
580
|
+
formatter.print_error(f"Failed to list transactions: {e}")
|
|
581
|
+
raise typer.Exit(1)
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
# Views commands
|
|
585
|
+
@views_app.command("list")
|
|
586
|
+
def list_views(
|
|
587
|
+
dataset_rid: str = typer.Argument(
|
|
588
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
589
|
+
),
|
|
590
|
+
profile: Optional[str] = typer.Option(
|
|
591
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
592
|
+
),
|
|
593
|
+
format: str = typer.Option(
|
|
594
|
+
"table",
|
|
595
|
+
"--format",
|
|
596
|
+
"-f",
|
|
597
|
+
help="Output format (table, json, csv)",
|
|
598
|
+
autocompletion=complete_output_format,
|
|
599
|
+
),
|
|
600
|
+
output: Optional[str] = typer.Option(
|
|
601
|
+
None, "--output", "-o", help="Output file path"
|
|
602
|
+
),
|
|
603
|
+
):
|
|
604
|
+
"""List views for a dataset."""
|
|
605
|
+
try:
|
|
606
|
+
cache_rid(dataset_rid)
|
|
607
|
+
service = DatasetService(profile=profile)
|
|
608
|
+
|
|
609
|
+
with SpinnerProgressTracker().track_spinner(
|
|
610
|
+
f"Fetching views for {dataset_rid}..."
|
|
611
|
+
):
|
|
612
|
+
views = service.get_views(dataset_rid)
|
|
613
|
+
|
|
614
|
+
formatter.format_views(views, format, output)
|
|
615
|
+
|
|
616
|
+
if output:
|
|
617
|
+
formatter.print_success(f"Views information saved to {output}")
|
|
618
|
+
|
|
619
|
+
except NotImplementedError as e:
|
|
620
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
621
|
+
raise typer.Exit(0)
|
|
622
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
623
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
624
|
+
raise typer.Exit(1)
|
|
625
|
+
except Exception as e:
|
|
626
|
+
formatter.print_error(f"Failed to list views: {e}")
|
|
627
|
+
raise typer.Exit(1)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
@views_app.command("create")
|
|
631
|
+
def create_view(
|
|
632
|
+
dataset_rid: str = typer.Argument(
|
|
633
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
634
|
+
),
|
|
635
|
+
view_name: str = typer.Argument(..., help="View name"),
|
|
636
|
+
description: Optional[str] = typer.Option(
|
|
637
|
+
None, "--description", help="View description"
|
|
638
|
+
),
|
|
639
|
+
profile: Optional[str] = typer.Option(
|
|
640
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
641
|
+
),
|
|
642
|
+
format: str = typer.Option(
|
|
643
|
+
"table",
|
|
644
|
+
"--format",
|
|
645
|
+
"-f",
|
|
646
|
+
help="Output format (table, json, csv)",
|
|
647
|
+
autocompletion=complete_output_format,
|
|
648
|
+
),
|
|
649
|
+
):
|
|
650
|
+
"""Create a new view for a dataset."""
|
|
651
|
+
try:
|
|
652
|
+
cache_rid(dataset_rid)
|
|
653
|
+
service = DatasetService(profile=profile)
|
|
654
|
+
|
|
655
|
+
with SpinnerProgressTracker().track_spinner(
|
|
656
|
+
f"Creating view '{view_name}' for {dataset_rid}..."
|
|
657
|
+
):
|
|
658
|
+
view = service.create_view(dataset_rid, view_name, description)
|
|
659
|
+
|
|
660
|
+
formatter.print_success(f"Successfully created view '{view_name}'")
|
|
661
|
+
formatter.format_view_detail(view, format)
|
|
662
|
+
|
|
663
|
+
except NotImplementedError as e:
|
|
664
|
+
formatter.print_warning(f"Feature not available: {e}")
|
|
665
|
+
raise typer.Exit(0)
|
|
666
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
667
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
668
|
+
raise typer.Exit(1)
|
|
669
|
+
except Exception as e:
|
|
670
|
+
formatter.print_error(f"Failed to create view: {e}")
|
|
671
|
+
raise typer.Exit(1)
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
# Add subcommands to main app
|
|
675
|
+
app.add_typer(branches_app, name="branches")
|
|
676
|
+
app.add_typer(files_app, name="files")
|
|
677
|
+
app.add_typer(transactions_app, name="transactions")
|
|
678
|
+
app.add_typer(views_app, name="views")
|
|
679
|
+
|
|
680
|
+
|
|
104
681
|
@app.callback()
|
|
105
682
|
def main():
|
|
106
683
|
"""
|