pltr-cli 0.5.1__py3-none-any.whl → 0.5.2__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.5.2"
pltr/services/dataset.py CHANGED
@@ -149,14 +149,12 @@ class DatasetService(BaseService):
149
149
  raise FileNotFoundError(f"File not found: {file_path}")
150
150
 
151
151
  try:
152
- with open(file_path, "rb") as f:
153
- result = self.service.upload_file(
154
- dataset_rid=dataset_rid,
155
- file_path=file_path.name,
156
- file_data=f,
157
- branch=branch,
158
- transaction_rid=transaction_rid,
159
- )
152
+ result = self.service.Dataset.File.upload(
153
+ dataset_rid=dataset_rid,
154
+ file_path=str(file_path),
155
+ branch_name=branch,
156
+ transaction_rid=transaction_rid,
157
+ )
160
158
 
161
159
  return {
162
160
  "dataset_rid": dataset_rid,
@@ -196,8 +194,8 @@ class DatasetService(BaseService):
196
194
  # Ensure output directory exists
197
195
  output_path.parent.mkdir(parents=True, exist_ok=True)
198
196
 
199
- file_content = self.service.download_file(
200
- dataset_rid=dataset_rid, file_path=file_path, branch=branch
197
+ file_content = self.service.Dataset.File.read(
198
+ dataset_rid=dataset_rid, file_path=file_path, branch_name=branch
201
199
  )
202
200
 
203
201
  # Write file content to disk
@@ -236,7 +234,9 @@ class DatasetService(BaseService):
236
234
  List of file information dictionaries
237
235
  """
238
236
  try:
239
- files = self.service.list_files(dataset_rid=dataset_rid, branch=branch)
237
+ files = self.service.Dataset.File.list(
238
+ dataset_rid=dataset_rid, branch_name=branch
239
+ )
240
240
 
241
241
  return [
242
242
  {
@@ -322,11 +322,11 @@ class DatasetService(BaseService):
322
322
  Transaction information dictionary
323
323
  """
324
324
  try:
325
- # Try to use the v2 API's Dataset.create_transaction method
326
- transaction = self.service.Dataset.create_transaction(
325
+ # Use the v2 API's Dataset.Transaction.create method
326
+ transaction = self.service.Dataset.Transaction.create(
327
327
  dataset_rid=dataset_rid,
328
- branch=branch,
329
328
  transaction_type=transaction_type,
329
+ branch_name=branch,
330
330
  )
331
331
 
332
332
  return {
@@ -338,27 +338,6 @@ class DatasetService(BaseService):
338
338
  "created_time": getattr(transaction, "created_time", None),
339
339
  "created_by": getattr(transaction, "created_by", None),
340
340
  }
341
- except AttributeError:
342
- # Fallback to service.create_transaction if available
343
- try:
344
- transaction = self.service.create_transaction(
345
- dataset_rid=dataset_rid,
346
- branch=branch,
347
- transaction_type=transaction_type,
348
- )
349
- return {
350
- "transaction_rid": getattr(transaction, "rid", None),
351
- "dataset_rid": dataset_rid,
352
- "branch": branch,
353
- "transaction_type": transaction_type,
354
- "status": getattr(transaction, "status", "OPEN"),
355
- "created_time": getattr(transaction, "created_time", None),
356
- "created_by": getattr(transaction, "created_by", None),
357
- }
358
- except Exception as e:
359
- raise RuntimeError(
360
- f"Failed to create transaction for dataset {dataset_rid}: {e}"
361
- )
362
341
  except Exception as e:
363
342
  raise RuntimeError(
364
343
  f"Failed to create transaction for dataset {dataset_rid}: {e}"
@@ -378,8 +357,8 @@ class DatasetService(BaseService):
378
357
  Transaction commit result
379
358
  """
380
359
  try:
381
- # Try the v2 API first (Dataset.commit_transaction)
382
- self.service.Dataset.commit_transaction(
360
+ # Use the v2 API Dataset.Transaction.commit method
361
+ self.service.Dataset.Transaction.commit(
383
362
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
384
363
  )
385
364
 
@@ -390,23 +369,6 @@ class DatasetService(BaseService):
390
369
  "committed_time": None, # Would need to get this from a status call
391
370
  "success": True,
392
371
  }
393
- except AttributeError:
394
- # Fallback to service.commit_transaction
395
- try:
396
- self.service.commit_transaction(
397
- dataset_rid=dataset_rid, transaction_rid=transaction_rid
398
- )
399
- return {
400
- "transaction_rid": transaction_rid,
401
- "dataset_rid": dataset_rid,
402
- "status": "COMMITTED",
403
- "committed_time": None,
404
- "success": True,
405
- }
406
- except Exception as e:
407
- raise RuntimeError(
408
- f"Failed to commit transaction {transaction_rid}: {e}"
409
- )
410
372
  except Exception as e:
411
373
  raise RuntimeError(f"Failed to commit transaction {transaction_rid}: {e}")
412
374
 
@@ -424,8 +386,8 @@ class DatasetService(BaseService):
424
386
  Transaction abort result
425
387
  """
426
388
  try:
427
- # Try the v2 API first (Dataset.abort_transaction)
428
- self.service.Dataset.abort_transaction(
389
+ # Use the v2 API Dataset.Transaction.abort method
390
+ self.service.Dataset.Transaction.abort(
429
391
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
430
392
  )
431
393
 
@@ -436,23 +398,6 @@ class DatasetService(BaseService):
436
398
  "aborted_time": None, # Would need to get this from a status call
437
399
  "success": True,
438
400
  }
439
- except AttributeError:
440
- # Fallback to service.abort_transaction
441
- try:
442
- self.service.abort_transaction(
443
- dataset_rid=dataset_rid, transaction_rid=transaction_rid
444
- )
445
- return {
446
- "transaction_rid": transaction_rid,
447
- "dataset_rid": dataset_rid,
448
- "status": "ABORTED",
449
- "aborted_time": None,
450
- "success": True,
451
- }
452
- except Exception as e:
453
- raise RuntimeError(
454
- f"Failed to abort transaction {transaction_rid}: {e}"
455
- )
456
401
  except Exception as e:
457
402
  raise RuntimeError(f"Failed to abort transaction {transaction_rid}: {e}")
458
403
 
@@ -470,8 +415,8 @@ class DatasetService(BaseService):
470
415
  Transaction status information
471
416
  """
472
417
  try:
473
- # Try the v2 API first (Dataset.get_transaction)
474
- transaction = self.service.Dataset.get_transaction(
418
+ # Use the v2 API Dataset.Transaction.get method
419
+ transaction = self.service.Dataset.Transaction.get(
475
420
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
476
421
  )
477
422
 
@@ -486,27 +431,6 @@ class DatasetService(BaseService):
486
431
  "committed_time": getattr(transaction, "committed_time", None),
487
432
  "aborted_time": getattr(transaction, "aborted_time", None),
488
433
  }
489
- except AttributeError:
490
- # Fallback to service.get_transaction
491
- try:
492
- transaction = self.service.get_transaction(
493
- dataset_rid=dataset_rid, transaction_rid=transaction_rid
494
- )
495
- return {
496
- "transaction_rid": transaction_rid,
497
- "dataset_rid": dataset_rid,
498
- "status": getattr(transaction, "status", None),
499
- "transaction_type": getattr(transaction, "transaction_type", None),
500
- "branch": getattr(transaction, "branch", None),
501
- "created_time": getattr(transaction, "created_time", None),
502
- "created_by": getattr(transaction, "created_by", None),
503
- "committed_time": getattr(transaction, "committed_time", None),
504
- "aborted_time": getattr(transaction, "aborted_time", None),
505
- }
506
- except Exception as e:
507
- raise RuntimeError(
508
- f"Failed to get transaction status {transaction_rid}: {e}"
509
- )
510
434
  except Exception as e:
511
435
  raise RuntimeError(
512
436
  f"Failed to get transaction status {transaction_rid}: {e}"
@@ -526,9 +450,10 @@ class DatasetService(BaseService):
526
450
  List of transaction information dictionaries
527
451
  """
528
452
  try:
529
- # Try the v2 API first (Dataset.list_transactions)
530
- transactions = self.service.Dataset.list_transactions(
531
- dataset_rid=dataset_rid, branch=branch
453
+ # Use the v2 API Dataset.Transaction for transaction listing
454
+ # Note: This method may not exist in all SDK versions
455
+ transactions = self.service.Dataset.Transaction.list(
456
+ dataset_rid=dataset_rid, branch_name=branch
532
457
  )
533
458
 
534
459
  return [
@@ -545,37 +470,11 @@ class DatasetService(BaseService):
545
470
  for transaction in transactions
546
471
  ]
547
472
  except AttributeError:
548
- # Fallback to service.list_transactions
549
- try:
550
- transactions = self.service.list_transactions(
551
- dataset_rid=dataset_rid, branch=branch
552
- )
553
-
554
- return [
555
- {
556
- "transaction_rid": getattr(transaction, "rid", None),
557
- "created_time": getattr(transaction, "created_time", None),
558
- "created_by": getattr(transaction, "created_by", None),
559
- "status": getattr(transaction, "status", None),
560
- "transaction_type": getattr(
561
- transaction, "transaction_type", None
562
- ),
563
- "branch": getattr(transaction, "branch", branch),
564
- "committed_time": getattr(transaction, "committed_time", None),
565
- "aborted_time": getattr(transaction, "aborted_time", None),
566
- }
567
- for transaction in transactions
568
- ]
569
- except AttributeError:
570
- # Method not available in this SDK version
571
- raise NotImplementedError(
572
- "Transaction listing is not supported by this SDK version. "
573
- "This feature may require a newer version of foundry-platform-python."
574
- )
575
- except Exception as e:
576
- raise RuntimeError(
577
- f"Failed to get transactions for dataset {dataset_rid}: {e}"
578
- )
473
+ # Method not available in this SDK version
474
+ raise NotImplementedError(
475
+ "Transaction listing is not supported by this SDK version. "
476
+ "This feature may require a newer version of foundry-platform-python."
477
+ )
579
478
  except Exception as e:
580
479
  raise RuntimeError(
581
480
  f"Failed to get transactions for dataset {dataset_rid}: {e}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pltr-cli
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Command-line interface for Palantir Foundry APIs
5
5
  Project-URL: Homepage, https://github.com/anjor/pltr-cli
6
6
  Project-URL: Repository, https://github.com/anjor/pltr-cli
@@ -1,4 +1,4 @@
1
- pltr/__init__.py,sha256=LBK46heutvn3KmsCrKIYu8RQikbfnjZaj2xFrXaeCzQ,22
1
+ pltr/__init__.py,sha256=isJrmDBLRag7Zc2UK9ZovWGOv7ji1Oh-zJtJMNJFkXw,22
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
@@ -33,7 +33,7 @@ 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=R2G781FI-sXtjUyLd91bVnmLb4cYZI3G8U5ndR9NLA4,1593
35
35
  pltr/services/connectivity.py,sha256=34kazXhue5gNi1_2s2R5Ma4VQe6jP25CO-ztiPhCeZw,10548
36
- pltr/services/dataset.py,sha256=L_SZ0yFIq3Zlx_eHtOwpRYZcUh1xGG7pIlbCRnYjrbs,25175
36
+ pltr/services/dataset.py,sha256=OeKRkkTRT_3uALsvipVzaFIOYRatqXUxLbLkbyCiqLc,20478
37
37
  pltr/services/folder.py,sha256=mWElyvn-wXPB5sv8Ik_dLeW5JM6jZg3g9KKBk6UcrlQ,5389
38
38
  pltr/services/mediasets.py,sha256=HgHNFWoG9r-5xupANVOxHg_h5EKsBDl6PsO8hwdbm28,9854
39
39
  pltr/services/ontology.py,sha256=iW7qRK8ptlw-u4eAwLNC-mdzLoLZzh7SRqJyok2c3GU,14883
@@ -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=MuIgi8dSqvhzik7H0YQOq1sYPnY_poZOYeTVvrIY2Jk,44235
50
50
  pltr/utils/progress.py,sha256=BKYbiLO61uhQbibabU7pxvvbAWMRLRmqk4pZldBQK_g,9053
51
- pltr_cli-0.5.1.dist-info/METADATA,sha256=eQiiY1B0njuRJbz5-rFJ9qsFkeIwVD2aPmGHIPmajhY,17714
52
- pltr_cli-0.5.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- pltr_cli-0.5.1.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
- pltr_cli-0.5.1.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
- pltr_cli-0.5.1.dist-info/RECORD,,
51
+ pltr_cli-0.5.2.dist-info/METADATA,sha256=vWl7v5qxGJIOJYHLsRjY4fHdCPk6sWav2BTn-xS0F1Y,17714
52
+ pltr_cli-0.5.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ pltr_cli-0.5.2.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
+ pltr_cli-0.5.2.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
+ pltr_cli-0.5.2.dist-info/RECORD,,