pltr-cli 0.5.1__py3-none-any.whl → 0.6.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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.6.0"
pltr/services/dataset.py CHANGED
@@ -149,14 +149,18 @@ class DatasetService(BaseService):
149
149
  raise FileNotFoundError(f"File not found: {file_path}")
150
150
 
151
151
  try:
152
+ # Read file content as bytes
152
153
  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
- )
154
+ file_content = f.read()
155
+
156
+ # Use the correct method signature with body parameter
157
+ result = self.service.Dataset.File.upload(
158
+ dataset_rid=dataset_rid,
159
+ file_path=file_path.name, # Just the filename, not full path
160
+ body=file_content,
161
+ branch_name=branch,
162
+ transaction_rid=transaction_rid,
163
+ )
160
164
 
161
165
  return {
162
166
  "dataset_rid": dataset_rid,
@@ -196,8 +200,8 @@ class DatasetService(BaseService):
196
200
  # Ensure output directory exists
197
201
  output_path.parent.mkdir(parents=True, exist_ok=True)
198
202
 
199
- file_content = self.service.download_file(
200
- dataset_rid=dataset_rid, file_path=file_path, branch=branch
203
+ file_content = self.service.Dataset.File.read(
204
+ dataset_rid=dataset_rid, file_path=file_path, branch_name=branch
201
205
  )
202
206
 
203
207
  # Write file content to disk
@@ -236,7 +240,9 @@ class DatasetService(BaseService):
236
240
  List of file information dictionaries
237
241
  """
238
242
  try:
239
- files = self.service.list_files(dataset_rid=dataset_rid, branch=branch)
243
+ files = self.service.Dataset.File.list(
244
+ dataset_rid=dataset_rid, branch_name=branch
245
+ )
240
246
 
241
247
  return [
242
248
  {
@@ -322,11 +328,11 @@ class DatasetService(BaseService):
322
328
  Transaction information dictionary
323
329
  """
324
330
  try:
325
- # Try to use the v2 API's Dataset.create_transaction method
326
- transaction = self.service.Dataset.create_transaction(
331
+ # Use the v2 API's Dataset.Transaction.create method
332
+ transaction = self.service.Dataset.Transaction.create(
327
333
  dataset_rid=dataset_rid,
328
- branch=branch,
329
334
  transaction_type=transaction_type,
335
+ branch_name=branch,
330
336
  )
331
337
 
332
338
  return {
@@ -338,27 +344,6 @@ class DatasetService(BaseService):
338
344
  "created_time": getattr(transaction, "created_time", None),
339
345
  "created_by": getattr(transaction, "created_by", None),
340
346
  }
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
347
  except Exception as e:
363
348
  raise RuntimeError(
364
349
  f"Failed to create transaction for dataset {dataset_rid}: {e}"
@@ -378,8 +363,8 @@ class DatasetService(BaseService):
378
363
  Transaction commit result
379
364
  """
380
365
  try:
381
- # Try the v2 API first (Dataset.commit_transaction)
382
- self.service.Dataset.commit_transaction(
366
+ # Use the v2 API Dataset.Transaction.commit method
367
+ self.service.Dataset.Transaction.commit(
383
368
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
384
369
  )
385
370
 
@@ -390,23 +375,6 @@ class DatasetService(BaseService):
390
375
  "committed_time": None, # Would need to get this from a status call
391
376
  "success": True,
392
377
  }
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
378
  except Exception as e:
411
379
  raise RuntimeError(f"Failed to commit transaction {transaction_rid}: {e}")
412
380
 
@@ -424,8 +392,8 @@ class DatasetService(BaseService):
424
392
  Transaction abort result
425
393
  """
426
394
  try:
427
- # Try the v2 API first (Dataset.abort_transaction)
428
- self.service.Dataset.abort_transaction(
395
+ # Use the v2 API Dataset.Transaction.abort method
396
+ self.service.Dataset.Transaction.abort(
429
397
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
430
398
  )
431
399
 
@@ -436,23 +404,6 @@ class DatasetService(BaseService):
436
404
  "aborted_time": None, # Would need to get this from a status call
437
405
  "success": True,
438
406
  }
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
407
  except Exception as e:
457
408
  raise RuntimeError(f"Failed to abort transaction {transaction_rid}: {e}")
458
409
 
@@ -470,8 +421,8 @@ class DatasetService(BaseService):
470
421
  Transaction status information
471
422
  """
472
423
  try:
473
- # Try the v2 API first (Dataset.get_transaction)
474
- transaction = self.service.Dataset.get_transaction(
424
+ # Use the v2 API Dataset.Transaction.get method
425
+ transaction = self.service.Dataset.Transaction.get(
475
426
  dataset_rid=dataset_rid, transaction_rid=transaction_rid
476
427
  )
477
428
 
@@ -486,27 +437,6 @@ class DatasetService(BaseService):
486
437
  "committed_time": getattr(transaction, "committed_time", None),
487
438
  "aborted_time": getattr(transaction, "aborted_time", None),
488
439
  }
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
440
  except Exception as e:
511
441
  raise RuntimeError(
512
442
  f"Failed to get transaction status {transaction_rid}: {e}"
@@ -526,9 +456,10 @@ class DatasetService(BaseService):
526
456
  List of transaction information dictionaries
527
457
  """
528
458
  try:
529
- # Try the v2 API first (Dataset.list_transactions)
530
- transactions = self.service.Dataset.list_transactions(
531
- dataset_rid=dataset_rid, branch=branch
459
+ # Use the v2 API Dataset.Transaction for transaction listing
460
+ # Note: This method may not exist in all SDK versions
461
+ transactions = self.service.Dataset.Transaction.list(
462
+ dataset_rid=dataset_rid, branch_name=branch
532
463
  )
533
464
 
534
465
  return [
@@ -545,37 +476,11 @@ class DatasetService(BaseService):
545
476
  for transaction in transactions
546
477
  ]
547
478
  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
- )
479
+ # Method not available in this SDK version
480
+ raise NotImplementedError(
481
+ "Transaction listing is not supported by this SDK version. "
482
+ "This feature may require a newer version of foundry-platform-python."
483
+ )
579
484
  except Exception as e:
580
485
  raise RuntimeError(
581
486
  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.6.0
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=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,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=Bq-hl7sapUCIaVv5Pu5R--7oJW9nQTJF5-SLLqctGM4,20743
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.6.0.dist-info/METADATA,sha256=NRLw-SKI_odcbgeIVFELDsLAwjo8q2juwqbwntlF2I0,17714
52
+ pltr_cli-0.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ pltr_cli-0.6.0.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
+ pltr_cli-0.6.0.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
+ pltr_cli-0.6.0.dist-info/RECORD,,