pltr-cli 0.11.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 +40 -0
- pltr/commands/admin.py +565 -11
- pltr/commands/aip_agents.py +333 -0
- pltr/commands/connectivity.py +309 -1
- pltr/commands/cp.py +103 -0
- pltr/commands/dataset.py +104 -4
- pltr/commands/functions.py +503 -0
- pltr/commands/language_models.py +515 -0
- pltr/commands/mediasets.py +176 -0
- pltr/commands/models.py +362 -0
- pltr/commands/ontology.py +44 -13
- pltr/commands/orchestration.py +167 -11
- pltr/commands/project.py +231 -22
- pltr/commands/resource.py +416 -17
- pltr/commands/space.py +25 -303
- pltr/commands/sql.py +54 -7
- pltr/commands/streams.py +616 -0
- pltr/commands/third_party_applications.py +82 -0
- pltr/services/admin.py +331 -3
- pltr/services/aip_agents.py +147 -0
- pltr/services/base.py +104 -1
- pltr/services/connectivity.py +139 -0
- pltr/services/copy.py +391 -0
- pltr/services/dataset.py +77 -4
- pltr/services/folder.py +6 -1
- pltr/services/functions.py +223 -0
- pltr/services/language_models.py +281 -0
- pltr/services/mediasets.py +144 -9
- pltr/services/models.py +179 -0
- pltr/services/ontology.py +48 -1
- pltr/services/orchestration.py +133 -1
- pltr/services/project.py +213 -39
- pltr/services/resource.py +229 -60
- pltr/services/space.py +24 -175
- pltr/services/sql.py +44 -20
- pltr/services/streams.py +290 -0
- pltr/services/third_party_applications.py +53 -0
- pltr/utils/formatting.py +195 -1
- pltr/utils/pagination.py +325 -0
- {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/METADATA +55 -4
- pltr_cli-0.13.0.dist-info/RECORD +70 -0
- {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/WHEEL +1 -1
- pltr_cli-0.11.0.dist-info/RECORD +0 -55
- {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.11.0.dist-info → pltr_cli-0.13.0.dist-info}/licenses/LICENSE +0 -0
pltr/commands/cp.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copy resources between Compass folders.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
import typer
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
|
|
12
|
+
from ..auth.base import MissingCredentialsError, ProfileNotFoundError
|
|
13
|
+
from ..services.copy import CopyService
|
|
14
|
+
from ..utils.completion import complete_profile, complete_rid
|
|
15
|
+
from ..utils.formatting import OutputFormatter
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def cp_command(
|
|
19
|
+
source_rid: str = typer.Argument(
|
|
20
|
+
...,
|
|
21
|
+
help="Resource Identifier to copy (dataset or folder)",
|
|
22
|
+
autocompletion=complete_rid,
|
|
23
|
+
),
|
|
24
|
+
target_folder_rid: str = typer.Argument(
|
|
25
|
+
...,
|
|
26
|
+
help="Destination Compass folder RID",
|
|
27
|
+
autocompletion=complete_rid,
|
|
28
|
+
),
|
|
29
|
+
profile: Optional[str] = typer.Option(
|
|
30
|
+
None,
|
|
31
|
+
"--profile",
|
|
32
|
+
help="Authentication profile",
|
|
33
|
+
autocompletion=complete_profile,
|
|
34
|
+
),
|
|
35
|
+
recursive: bool = typer.Option(
|
|
36
|
+
False,
|
|
37
|
+
"--recursive",
|
|
38
|
+
"-r",
|
|
39
|
+
help="Copy folder contents recursively (required when SOURCE_RID is a folder)",
|
|
40
|
+
),
|
|
41
|
+
branch: str = typer.Option(
|
|
42
|
+
"master",
|
|
43
|
+
"--branch",
|
|
44
|
+
"-b",
|
|
45
|
+
help="Dataset branch to copy file-backed datasets from",
|
|
46
|
+
),
|
|
47
|
+
name_suffix: str = typer.Option(
|
|
48
|
+
"-copy",
|
|
49
|
+
"--name-suffix",
|
|
50
|
+
help="Suffix appended to cloned folder/dataset names",
|
|
51
|
+
),
|
|
52
|
+
copy_schema: bool = typer.Option(
|
|
53
|
+
True,
|
|
54
|
+
"--schema/--no-schema",
|
|
55
|
+
help="Copy dataset schemas when available",
|
|
56
|
+
),
|
|
57
|
+
dry_run: bool = typer.Option(
|
|
58
|
+
False,
|
|
59
|
+
"--dry-run",
|
|
60
|
+
help="Log actions without creating any resources",
|
|
61
|
+
),
|
|
62
|
+
fail_fast: bool = typer.Option(
|
|
63
|
+
False,
|
|
64
|
+
"--fail-fast",
|
|
65
|
+
help="Stop immediately on first error when copying folders recursively",
|
|
66
|
+
),
|
|
67
|
+
debug: bool = typer.Option(
|
|
68
|
+
False,
|
|
69
|
+
"--debug",
|
|
70
|
+
help="Print stack traces when errors occur",
|
|
71
|
+
),
|
|
72
|
+
):
|
|
73
|
+
"""Copy a resource identified by RID into another Compass folder."""
|
|
74
|
+
console = Console()
|
|
75
|
+
formatter = OutputFormatter(console)
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
service = CopyService(
|
|
79
|
+
profile=profile,
|
|
80
|
+
branch=branch,
|
|
81
|
+
name_suffix=name_suffix,
|
|
82
|
+
copy_schema=copy_schema,
|
|
83
|
+
dry_run=dry_run,
|
|
84
|
+
fail_fast=fail_fast,
|
|
85
|
+
debug=debug,
|
|
86
|
+
console=console,
|
|
87
|
+
)
|
|
88
|
+
summary = service.copy_resource(
|
|
89
|
+
source_rid, target_folder_rid, recursive=recursive
|
|
90
|
+
)
|
|
91
|
+
formatter.print_success("Copy operation completed")
|
|
92
|
+
formatter.print_info(
|
|
93
|
+
"Folders copied: {folders_copied} | Datasets copied: {datasets_copied} | "
|
|
94
|
+
"Skipped: {skipped} | Errors: {errors}".format(**summary)
|
|
95
|
+
)
|
|
96
|
+
except (ProfileNotFoundError, MissingCredentialsError) as exc:
|
|
97
|
+
formatter.print_error(f"Authentication error: {exc}")
|
|
98
|
+
raise typer.Exit(1)
|
|
99
|
+
except Exception as exc:
|
|
100
|
+
if debug:
|
|
101
|
+
raise
|
|
102
|
+
formatter.print_error(f"Failed to copy resource: {exc}")
|
|
103
|
+
raise typer.Exit(1)
|
pltr/commands/dataset.py
CHANGED
|
@@ -8,6 +8,7 @@ from rich.console import Console
|
|
|
8
8
|
|
|
9
9
|
from ..services.dataset import DatasetService
|
|
10
10
|
from ..utils.formatting import OutputFormatter
|
|
11
|
+
from ..utils.pagination import PaginationConfig
|
|
11
12
|
from ..utils.progress import SpinnerProgressTracker
|
|
12
13
|
from ..auth.base import ProfileNotFoundError, MissingCredentialsError
|
|
13
14
|
from ..utils.completion import (
|
|
@@ -73,6 +74,55 @@ def get_dataset(
|
|
|
73
74
|
raise typer.Exit(1)
|
|
74
75
|
|
|
75
76
|
|
|
77
|
+
@app.command("preview")
|
|
78
|
+
def preview_dataset(
|
|
79
|
+
dataset_rid: str = typer.Argument(
|
|
80
|
+
..., help="Dataset Resource Identifier", autocompletion=complete_rid
|
|
81
|
+
),
|
|
82
|
+
limit: int = typer.Option(
|
|
83
|
+
10, "--limit", "-n", help="Number of rows to display", min=1
|
|
84
|
+
),
|
|
85
|
+
profile: Optional[str] = typer.Option(
|
|
86
|
+
None, "--profile", "-p", help="Profile name", autocompletion=complete_profile
|
|
87
|
+
),
|
|
88
|
+
format: str = typer.Option(
|
|
89
|
+
"table",
|
|
90
|
+
"--format",
|
|
91
|
+
"-f",
|
|
92
|
+
help="Output format (table, json, csv)",
|
|
93
|
+
autocompletion=complete_output_format,
|
|
94
|
+
),
|
|
95
|
+
output: Optional[str] = typer.Option(
|
|
96
|
+
None, "--output", "-o", help="Output file path"
|
|
97
|
+
),
|
|
98
|
+
):
|
|
99
|
+
"""Preview dataset contents."""
|
|
100
|
+
try:
|
|
101
|
+
cache_rid(dataset_rid)
|
|
102
|
+
service = DatasetService(profile=profile)
|
|
103
|
+
|
|
104
|
+
with SpinnerProgressTracker().track_spinner(
|
|
105
|
+
f"Fetching preview of {dataset_rid} (limit: {limit})..."
|
|
106
|
+
):
|
|
107
|
+
data = service.preview_data(dataset_rid, limit=limit)
|
|
108
|
+
|
|
109
|
+
if not data:
|
|
110
|
+
formatter.print_warning("Dataset is empty or has no readable data")
|
|
111
|
+
return
|
|
112
|
+
|
|
113
|
+
formatter.format_output(data, format, output)
|
|
114
|
+
|
|
115
|
+
if output:
|
|
116
|
+
formatter.print_success(f"Preview saved to {output}")
|
|
117
|
+
|
|
118
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
119
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
120
|
+
raise typer.Exit(1)
|
|
121
|
+
except Exception as e:
|
|
122
|
+
formatter.print_error(f"Failed to preview dataset: {e}")
|
|
123
|
+
raise typer.Exit(1)
|
|
124
|
+
|
|
125
|
+
|
|
76
126
|
# Schema commands
|
|
77
127
|
@schema_app.command("get")
|
|
78
128
|
def get_schema(
|
|
@@ -566,21 +616,71 @@ def list_files(
|
|
|
566
616
|
output: Optional[str] = typer.Option(
|
|
567
617
|
None, "--output", "-o", help="Output file path"
|
|
568
618
|
),
|
|
619
|
+
page_size: Optional[int] = typer.Option(
|
|
620
|
+
None, "--page-size", help="Number of files per page (default: from settings)"
|
|
621
|
+
),
|
|
622
|
+
max_pages: Optional[int] = typer.Option(
|
|
623
|
+
1, "--max-pages", help="Maximum number of pages to fetch (default: 1)"
|
|
624
|
+
),
|
|
625
|
+
page_token: Optional[str] = typer.Option(
|
|
626
|
+
None, "--page-token", help="Page token to resume from previous response"
|
|
627
|
+
),
|
|
628
|
+
all: bool = typer.Option(
|
|
629
|
+
False, "--all", help="Fetch all available pages (overrides --max-pages)"
|
|
630
|
+
),
|
|
569
631
|
):
|
|
570
|
-
"""
|
|
632
|
+
"""
|
|
633
|
+
List files in a dataset with pagination support.
|
|
634
|
+
|
|
635
|
+
By default, fetches only the first page of results. Use --all to fetch all files,
|
|
636
|
+
or --max-pages to control how many pages to fetch. Critical for large datasets.
|
|
637
|
+
|
|
638
|
+
Examples:
|
|
639
|
+
# List first page of files (default)
|
|
640
|
+
pltr dataset files list DATASET_RID
|
|
641
|
+
|
|
642
|
+
# List all files
|
|
643
|
+
pltr dataset files list DATASET_RID --all
|
|
644
|
+
|
|
645
|
+
# List first 3 pages
|
|
646
|
+
pltr dataset files list DATASET_RID --max-pages 3
|
|
647
|
+
"""
|
|
571
648
|
try:
|
|
572
649
|
cache_rid(dataset_rid)
|
|
573
650
|
service = DatasetService(profile=profile)
|
|
574
651
|
|
|
652
|
+
# Create pagination config
|
|
653
|
+
config = PaginationConfig(
|
|
654
|
+
page_size=page_size,
|
|
655
|
+
max_pages=max_pages,
|
|
656
|
+
page_token=page_token,
|
|
657
|
+
fetch_all=all,
|
|
658
|
+
)
|
|
659
|
+
|
|
575
660
|
with SpinnerProgressTracker().track_spinner(
|
|
576
661
|
f"Fetching files from {dataset_rid} (branch: {branch})..."
|
|
577
662
|
):
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
formatter.format_files(files, format, output)
|
|
663
|
+
result = service.list_files_paginated(dataset_rid, branch, config)
|
|
581
664
|
|
|
665
|
+
# Format and display paginated results
|
|
582
666
|
if output:
|
|
667
|
+
formatter.format_paginated_output(
|
|
668
|
+
result,
|
|
669
|
+
format,
|
|
670
|
+
output,
|
|
671
|
+
formatter_fn=lambda data, fmt, out: formatter.format_files(
|
|
672
|
+
data, fmt, out
|
|
673
|
+
),
|
|
674
|
+
)
|
|
583
675
|
formatter.print_success(f"Files information saved to {output}")
|
|
676
|
+
else:
|
|
677
|
+
formatter.format_paginated_output(
|
|
678
|
+
result,
|
|
679
|
+
format,
|
|
680
|
+
formatter_fn=lambda data, fmt, out: formatter.format_files(
|
|
681
|
+
data, fmt, out
|
|
682
|
+
),
|
|
683
|
+
)
|
|
584
684
|
|
|
585
685
|
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
586
686
|
formatter.print_error(f"Authentication error: {e}")
|