pltr-cli 0.10.0__py3-none-any.whl → 0.11.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/commands/ontology.py +93 -0
- pltr/services/dataset.py +5 -8
- pltr/services/ontology.py +71 -0
- {pltr_cli-0.10.0.dist-info → pltr_cli-0.11.0.dist-info}/METADATA +1 -1
- {pltr_cli-0.10.0.dist-info → pltr_cli-0.11.0.dist-info}/RECORD +9 -9
- {pltr_cli-0.10.0.dist-info → pltr_cli-0.11.0.dist-info}/WHEEL +0 -0
- {pltr_cli-0.10.0.dist-info → pltr_cli-0.11.0.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.10.0.dist-info → pltr_cli-0.11.0.dist-info}/licenses/LICENSE +0 -0
pltr/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.11.0"
|
pltr/commands/ontology.py
CHANGED
|
@@ -366,6 +366,99 @@ def list_linked_objects(
|
|
|
366
366
|
raise typer.Exit(1)
|
|
367
367
|
|
|
368
368
|
|
|
369
|
+
@app.command("object-count")
|
|
370
|
+
def count_objects(
|
|
371
|
+
ontology_rid: str = typer.Argument(..., help="Ontology Resource Identifier"),
|
|
372
|
+
object_type: str = typer.Argument(..., help="Object type API name"),
|
|
373
|
+
profile: Optional[str] = typer.Option(None, "--profile", "-p", help="Profile name"),
|
|
374
|
+
format: str = typer.Option(
|
|
375
|
+
"table", "--format", "-f", help="Output format (table, json, csv)"
|
|
376
|
+
),
|
|
377
|
+
output: Optional[str] = typer.Option(
|
|
378
|
+
None, "--output", "-o", help="Output file path"
|
|
379
|
+
),
|
|
380
|
+
branch: Optional[str] = typer.Option(None, "--branch", "-b", help="Branch name"),
|
|
381
|
+
):
|
|
382
|
+
"""Count objects of a specific type."""
|
|
383
|
+
try:
|
|
384
|
+
service = OntologyObjectService(profile=profile)
|
|
385
|
+
|
|
386
|
+
with SpinnerProgressTracker().track_spinner(
|
|
387
|
+
f"Counting {object_type} objects..."
|
|
388
|
+
):
|
|
389
|
+
result = service.count_objects(ontology_rid, object_type, branch=branch)
|
|
390
|
+
|
|
391
|
+
formatter.format_dict(result, format=format, output=output)
|
|
392
|
+
|
|
393
|
+
if output:
|
|
394
|
+
formatter.print_success(f"Count result saved to {output}")
|
|
395
|
+
|
|
396
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
397
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
398
|
+
raise typer.Exit(1)
|
|
399
|
+
except Exception as e:
|
|
400
|
+
formatter.print_error(f"Failed to count objects: {e}")
|
|
401
|
+
raise typer.Exit(1)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
@app.command("object-search")
|
|
405
|
+
def search_objects(
|
|
406
|
+
ontology_rid: str = typer.Argument(..., help="Ontology Resource Identifier"),
|
|
407
|
+
object_type: str = typer.Argument(..., help="Object type API name"),
|
|
408
|
+
query: str = typer.Option(..., "--query", "-q", help="Search query string"),
|
|
409
|
+
profile: Optional[str] = typer.Option(None, "--profile", "-p", help="Profile name"),
|
|
410
|
+
format: str = typer.Option(
|
|
411
|
+
"table", "--format", "-f", help="Output format (table, json, csv)"
|
|
412
|
+
),
|
|
413
|
+
output: Optional[str] = typer.Option(
|
|
414
|
+
None, "--output", "-o", help="Output file path"
|
|
415
|
+
),
|
|
416
|
+
page_size: Optional[int] = typer.Option(
|
|
417
|
+
None, "--page-size", help="Number of results per page"
|
|
418
|
+
),
|
|
419
|
+
properties: Optional[str] = typer.Option(
|
|
420
|
+
None, "--properties", help="Comma-separated list of properties to include"
|
|
421
|
+
),
|
|
422
|
+
branch: Optional[str] = typer.Option(None, "--branch", "-b", help="Branch name"),
|
|
423
|
+
):
|
|
424
|
+
"""Search objects by query."""
|
|
425
|
+
try:
|
|
426
|
+
service = OntologyObjectService(profile=profile)
|
|
427
|
+
|
|
428
|
+
prop_list = properties.split(",") if properties else None
|
|
429
|
+
|
|
430
|
+
with SpinnerProgressTracker().track_spinner(
|
|
431
|
+
f"Searching {object_type} objects..."
|
|
432
|
+
):
|
|
433
|
+
objects = service.search_objects(
|
|
434
|
+
ontology_rid,
|
|
435
|
+
object_type,
|
|
436
|
+
query,
|
|
437
|
+
page_size=page_size,
|
|
438
|
+
properties=prop_list,
|
|
439
|
+
branch=branch,
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
if format == "table" and objects:
|
|
443
|
+
# Use first object's keys as columns
|
|
444
|
+
columns = list(objects[0].keys()) if objects else []
|
|
445
|
+
formatter.format_table(
|
|
446
|
+
objects, columns=columns, format=format, output=output
|
|
447
|
+
)
|
|
448
|
+
else:
|
|
449
|
+
formatter.format_list(objects, format=format, output=output)
|
|
450
|
+
|
|
451
|
+
if output:
|
|
452
|
+
formatter.print_success(f"Search results saved to {output}")
|
|
453
|
+
|
|
454
|
+
except (ProfileNotFoundError, MissingCredentialsError) as e:
|
|
455
|
+
formatter.print_error(f"Authentication error: {e}")
|
|
456
|
+
raise typer.Exit(1)
|
|
457
|
+
except Exception as e:
|
|
458
|
+
formatter.print_error(f"Failed to search objects: {e}")
|
|
459
|
+
raise typer.Exit(1)
|
|
460
|
+
|
|
461
|
+
|
|
369
462
|
# Action commands
|
|
370
463
|
@app.command("action-apply")
|
|
371
464
|
def apply_action(
|
pltr/services/dataset.py
CHANGED
|
@@ -487,18 +487,15 @@ class DatasetService(BaseService):
|
|
|
487
487
|
# Ensure output directory exists
|
|
488
488
|
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
# Use Dataset.File.content() which returns bytes directly
|
|
491
|
+
# Note: In SDK v1.27.0, the method is 'content' not 'read'
|
|
492
|
+
file_content = self.service.Dataset.File.content(
|
|
491
493
|
dataset_rid=dataset_rid, file_path=file_path, branch_name=branch
|
|
492
494
|
)
|
|
493
495
|
|
|
494
|
-
# Write file content to disk
|
|
496
|
+
# Write file content to disk (file_content is bytes)
|
|
495
497
|
with open(output_path, "wb") as f:
|
|
496
|
-
|
|
497
|
-
# If it's a stream
|
|
498
|
-
f.write(file_content.read())
|
|
499
|
-
else:
|
|
500
|
-
# If it's bytes
|
|
501
|
-
f.write(file_content)
|
|
498
|
+
f.write(file_content)
|
|
502
499
|
|
|
503
500
|
return {
|
|
504
501
|
"dataset_rid": dataset_rid,
|
pltr/services/ontology.py
CHANGED
|
@@ -287,6 +287,77 @@ class OntologyObjectService(BaseService):
|
|
|
287
287
|
except Exception as e:
|
|
288
288
|
raise RuntimeError(f"Failed to list linked objects: {e}")
|
|
289
289
|
|
|
290
|
+
def count_objects(
|
|
291
|
+
self,
|
|
292
|
+
ontology_rid: str,
|
|
293
|
+
object_type: str,
|
|
294
|
+
branch: Optional[str] = None,
|
|
295
|
+
) -> Dict[str, Any]:
|
|
296
|
+
"""
|
|
297
|
+
Count objects of a specific type.
|
|
298
|
+
|
|
299
|
+
Args:
|
|
300
|
+
ontology_rid: Ontology Resource Identifier
|
|
301
|
+
object_type: Object type API name
|
|
302
|
+
branch: Branch name (optional)
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
Dictionary containing count information
|
|
306
|
+
"""
|
|
307
|
+
try:
|
|
308
|
+
count = self.service.OntologyObject.count(
|
|
309
|
+
ontology_rid,
|
|
310
|
+
object_type,
|
|
311
|
+
branch_name=branch,
|
|
312
|
+
)
|
|
313
|
+
return {
|
|
314
|
+
"ontology_rid": ontology_rid,
|
|
315
|
+
"object_type": object_type,
|
|
316
|
+
"count": count,
|
|
317
|
+
"branch": branch,
|
|
318
|
+
}
|
|
319
|
+
except Exception as e:
|
|
320
|
+
raise RuntimeError(f"Failed to count objects: {e}")
|
|
321
|
+
|
|
322
|
+
def search_objects(
|
|
323
|
+
self,
|
|
324
|
+
ontology_rid: str,
|
|
325
|
+
object_type: str,
|
|
326
|
+
query: str,
|
|
327
|
+
page_size: Optional[int] = None,
|
|
328
|
+
properties: Optional[List[str]] = None,
|
|
329
|
+
branch: Optional[str] = None,
|
|
330
|
+
) -> List[Dict[str, Any]]:
|
|
331
|
+
"""
|
|
332
|
+
Search objects by query.
|
|
333
|
+
|
|
334
|
+
Args:
|
|
335
|
+
ontology_rid: Ontology Resource Identifier
|
|
336
|
+
object_type: Object type API name
|
|
337
|
+
query: Search query string
|
|
338
|
+
page_size: Number of results per page
|
|
339
|
+
properties: List of properties to include
|
|
340
|
+
branch: Branch name (optional)
|
|
341
|
+
|
|
342
|
+
Returns:
|
|
343
|
+
List of matching object dictionaries
|
|
344
|
+
"""
|
|
345
|
+
try:
|
|
346
|
+
result = self.service.OntologyObject.search(
|
|
347
|
+
ontology_rid,
|
|
348
|
+
object_type,
|
|
349
|
+
query=query,
|
|
350
|
+
page_size=page_size,
|
|
351
|
+
properties=properties,
|
|
352
|
+
branch_name=branch,
|
|
353
|
+
)
|
|
354
|
+
objects = []
|
|
355
|
+
for obj in result:
|
|
356
|
+
objects.append(self._format_object(obj))
|
|
357
|
+
return objects
|
|
358
|
+
except Exception as e:
|
|
359
|
+
raise RuntimeError(f"Failed to search objects: {e}")
|
|
360
|
+
|
|
290
361
|
def _format_object(self, obj: Any) -> Dict[str, Any]:
|
|
291
362
|
"""Format object for consistent output."""
|
|
292
363
|
# Objects may have various properties - extract them dynamically
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pltr/__init__.py,sha256=
|
|
1
|
+
pltr/__init__.py,sha256=raMu9XA9JEjvdoTmFqcOw7qhJX24rYDP7XmS59TAO-Q,23
|
|
2
2
|
pltr/__main__.py,sha256=HWJ49UoAYBQCf8kjuySPmBTuUjTZrOx-y6PzMTyS1KE,879
|
|
3
3
|
pltr/cli.py,sha256=DikRsWsU7QWvRWHgB6wZIct916ebWyaub7PlAjKJXws,2664
|
|
4
4
|
pltr/auth/__init__.py,sha256=G0V-Rh25FaJsH2nhrf146XQQG_ApdbyPJNuHJC25kgk,38
|
|
@@ -16,7 +16,7 @@ pltr/commands/connectivity.py,sha256=m8_BYwHij_5IbrYFTU_SYYtbqLCjxA8VIQpbdlWJqHs
|
|
|
16
16
|
pltr/commands/dataset.py,sha256=zuYtBXAGcfRjxE7cP9Hsz2tqSlsdNzdIflGKwytHbVI,53346
|
|
17
17
|
pltr/commands/folder.py,sha256=ItUp49lyDWIoMv8RaNDo7JFyrlk-r_Klab9FCPXwUM8,10721
|
|
18
18
|
pltr/commands/mediasets.py,sha256=FXq7OtYU9wLgUxQFcS_fkA4i_CozGnsYKxh8GOSI0ok,15342
|
|
19
|
-
pltr/commands/ontology.py,sha256=
|
|
19
|
+
pltr/commands/ontology.py,sha256=I5USog2YyDP9rTrrhl_nEMmTrM94GICiR0T-HJ9LeAI,21858
|
|
20
20
|
pltr/commands/orchestration.py,sha256=mizGJIuMEJGAW9-ic_q-WawAe4PKBgtJSUfysk6YI68,23227
|
|
21
21
|
pltr/commands/project.py,sha256=nlfyy4OYkYK9rtjOQp9awgCnSJ1P6sgsp0vaXdvkHFY,14183
|
|
22
22
|
pltr/commands/resource.py,sha256=8lS_iHqkvjKwodvPwqaTD2vYbHwPdEx3U1u3IDgvcA4,18392
|
|
@@ -33,10 +33,10 @@ pltr/services/__init__.py,sha256=zQpgrqPdAkZI-nobi33mctU2-iGNgazzvjBVY8YRbSQ,101
|
|
|
33
33
|
pltr/services/admin.py,sha256=8FjExmDeIKeVqkAxM83SVvpp_pH9W-Q33cgVs6BHxLQ,9957
|
|
34
34
|
pltr/services/base.py,sha256=JF9cyYf7njZuj1ldOLdgzIDhJjOfazBvXPNR-gKVnMY,3682
|
|
35
35
|
pltr/services/connectivity.py,sha256=34kazXhue5gNi1_2s2R5Ma4VQe6jP25CO-ztiPhCeZw,10548
|
|
36
|
-
pltr/services/dataset.py,sha256=
|
|
36
|
+
pltr/services/dataset.py,sha256=PB5PrNpnuCfzr7bqQ0corTmFTdZ9j1YWUHtRjIrXorM,44995
|
|
37
37
|
pltr/services/folder.py,sha256=mWElyvn-wXPB5sv8Ik_dLeW5JM6jZg3g9KKBk6UcrlQ,5389
|
|
38
38
|
pltr/services/mediasets.py,sha256=HgHNFWoG9r-5xupANVOxHg_h5EKsBDl6PsO8hwdbm28,9854
|
|
39
|
-
pltr/services/ontology.py,sha256=
|
|
39
|
+
pltr/services/ontology.py,sha256=yZO0c2fzF0XTrXn-RImNWVBCKmAvngL55wxGJXR7mJU,17011
|
|
40
40
|
pltr/services/orchestration.py,sha256=z1lofohVNRVlKyHffo_K1-I-1f9ZqsLKxQuyUOhAGlY,14729
|
|
41
41
|
pltr/services/project.py,sha256=nwLXBX0MWgOnVQ7CAZQHnzZtSJY_hqlGyooFngQSjcc,7740
|
|
42
42
|
pltr/services/resource.py,sha256=J7cGsgy5lsWGu5fGhOQOo5TgFY7x0oCk3e1CRB3V9Dw,10186
|
|
@@ -48,8 +48,8 @@ pltr/utils/alias_resolver.py,sha256=DIF7P1UnUU8kqocJfIDEWjYq4s8_0KfqRZBbECeZEh8,
|
|
|
48
48
|
pltr/utils/completion.py,sha256=bjeqjleEfB2YcQFpcxvF0GoQ763F6KBbULSZC4FWY_g,4980
|
|
49
49
|
pltr/utils/formatting.py,sha256=TpxbOXdXbk_aUUnj8FrjMPLSnTmtlpYZf0Oe6g6Wmvc,50626
|
|
50
50
|
pltr/utils/progress.py,sha256=BKYbiLO61uhQbibabU7pxvvbAWMRLRmqk4pZldBQK_g,9053
|
|
51
|
-
pltr_cli-0.
|
|
52
|
-
pltr_cli-0.
|
|
53
|
-
pltr_cli-0.
|
|
54
|
-
pltr_cli-0.
|
|
55
|
-
pltr_cli-0.
|
|
51
|
+
pltr_cli-0.11.0.dist-info/METADATA,sha256=rDBrj8VA3UmOuJvA0bCSN0vcAXrE-IYUQktuc7e3XNQ,17715
|
|
52
|
+
pltr_cli-0.11.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
53
|
+
pltr_cli-0.11.0.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
|
|
54
|
+
pltr_cli-0.11.0.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
|
|
55
|
+
pltr_cli-0.11.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|