pltr-cli 0.5.0__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/utils/formatting.py CHANGED
@@ -1084,14 +1084,121 @@ class OutputFormatter:
1084
1084
  "Transaction RID": transaction.get("transaction_rid", "")[:12] + "..."
1085
1085
  if transaction.get("transaction_rid")
1086
1086
  else "",
1087
+ "Status": transaction.get("status", ""),
1088
+ "Type": transaction.get("transaction_type", ""),
1089
+ "Branch": transaction.get("branch", ""),
1087
1090
  "Created": self._format_datetime(transaction.get("created_time")),
1088
1091
  "Created By": transaction.get("created_by", ""),
1089
- "Status": transaction.get("status", ""),
1090
1092
  }
1091
1093
  formatted_transactions.append(formatted_transaction)
1092
1094
 
1093
1095
  return self.format_output(formatted_transactions, format_type, output_file)
1094
1096
 
1097
+ def format_transaction_detail(
1098
+ self,
1099
+ transaction: Dict[str, Any],
1100
+ format_type: str = "table",
1101
+ output_file: Optional[str] = None,
1102
+ ) -> Optional[str]:
1103
+ """
1104
+ Format detailed transaction information.
1105
+
1106
+ Args:
1107
+ transaction: Transaction dictionary
1108
+ format_type: Output format
1109
+ output_file: Optional output file path
1110
+
1111
+ Returns:
1112
+ Formatted string if no output file specified
1113
+ """
1114
+ if format_type == "table":
1115
+ details = []
1116
+
1117
+ property_order = [
1118
+ ("transaction_rid", "Transaction RID"),
1119
+ ("dataset_rid", "Dataset RID"),
1120
+ ("status", "Status"),
1121
+ ("transaction_type", "Type"),
1122
+ ("branch", "Branch"),
1123
+ ("created_time", "Created"),
1124
+ ("created_by", "Created By"),
1125
+ ("committed_time", "Committed"),
1126
+ ("aborted_time", "Aborted"),
1127
+ ]
1128
+
1129
+ for key, label in property_order:
1130
+ if transaction.get(key) is not None:
1131
+ value = transaction[key]
1132
+ if "time" in key:
1133
+ value = self._format_datetime(value)
1134
+ details.append({"Property": label, "Value": str(value)})
1135
+
1136
+ # Add any remaining properties
1137
+ for key, value in transaction.items():
1138
+ if (
1139
+ key not in [prop[0] for prop in property_order]
1140
+ and value is not None
1141
+ ):
1142
+ details.append(
1143
+ {"Property": key.replace("_", " ").title(), "Value": str(value)}
1144
+ )
1145
+
1146
+ return self.format_output(details, format_type, output_file)
1147
+ else:
1148
+ return self.format_output(transaction, format_type, output_file)
1149
+
1150
+ def format_transaction_result(
1151
+ self,
1152
+ result: Dict[str, Any],
1153
+ format_type: str = "table",
1154
+ output_file: Optional[str] = None,
1155
+ ) -> Optional[str]:
1156
+ """
1157
+ Format transaction operation result.
1158
+
1159
+ Args:
1160
+ result: Transaction operation result dictionary
1161
+ format_type: Output format
1162
+ output_file: Optional output file path
1163
+
1164
+ Returns:
1165
+ Formatted string if no output file specified
1166
+ """
1167
+ if format_type == "table":
1168
+ details = []
1169
+
1170
+ property_order = [
1171
+ ("transaction_rid", "Transaction RID"),
1172
+ ("dataset_rid", "Dataset RID"),
1173
+ ("status", "Status"),
1174
+ ("success", "Success"),
1175
+ ("committed_time", "Committed Time"),
1176
+ ("aborted_time", "Aborted Time"),
1177
+ ]
1178
+
1179
+ for key, label in property_order:
1180
+ if result.get(key) is not None:
1181
+ value = result[key]
1182
+ if "time" in key:
1183
+ value = self._format_datetime(value)
1184
+ elif key == "success":
1185
+ value = "Yes" if value else "No"
1186
+ details.append({"Property": label, "Value": str(value)})
1187
+
1188
+ # Add any remaining properties
1189
+ for key, value in result.items():
1190
+ if (
1191
+ key not in [prop[0] for prop in property_order]
1192
+ and value is not None
1193
+ ):
1194
+ details.append(
1195
+ {"Property": key.replace("_", " ").title(), "Value": str(value)}
1196
+ )
1197
+
1198
+ return self.format_output(details, format_type, output_file)
1199
+ else:
1200
+ return self.format_output(result, format_type, output_file)
1201
+
1095
1202
  def format_views(
1096
1203
  self,
1097
1204
  views: List[Dict[str, Any]],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pltr-cli
3
- Version: 0.5.0
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
@@ -47,7 +47,11 @@ A comprehensive command-line interface for Palantir Foundry APIs, providing 80+
47
47
 
48
48
  - 🔐 **Secure Authentication**: Token and OAuth2 support with encrypted credential storage
49
49
  - 📊 **Dataset Operations**: Complete dataset management with branches, files, transactions, and views (RID-based API)
50
- - 📁 **Folder Management**: Create, explore, and manage Foundry filesystem structure
50
+ - 📁 **Filesystem Management**: Complete filesystem operations including folders, projects, spaces, and resources
51
+ - 🏗️ **Project Management**: Create, update, and manage Foundry projects within spaces
52
+ - 🌐 **Space Management**: Administer spaces, manage members, and control access
53
+ - 🔐 **Resource Permissions**: Grant, revoke, and manage role-based access to resources
54
+ - 🔗 **Connectivity & Imports**: Manage external connections and import files/tables from various data sources
51
55
  - 🎯 **Comprehensive Ontology Access**: 13 commands for objects, actions, and queries
52
56
  - 🏗️ **Orchestration Management**: Create, manage, and monitor builds, jobs, and schedules
53
57
  - 🎬 **MediaSets Operations**: Upload, download, and manage media content with transaction support
@@ -121,6 +125,15 @@ pltr folder create "My Project"
121
125
  # List root folder contents
122
126
  pltr folder list ri.compass.main.folder.0
123
127
 
128
+ # Manage spaces and projects
129
+ pltr space list
130
+ pltr project create "My Project" ri.compass.main.space.123
131
+ pltr project list --space-rid ri.compass.main.space.123
132
+
133
+ # Manage resource permissions
134
+ pltr resource-role grant ri.compass.main.dataset.123 user123 User viewer
135
+ pltr resource-role list ri.compass.main.dataset.123
136
+
124
137
  # Execute a simple SQL query
125
138
  pltr sql execute "SELECT 1 as test"
126
139
 
@@ -129,6 +142,11 @@ pltr dataset get ri.foundry.main.dataset.abc123
129
142
  pltr dataset branches list ri.foundry.main.dataset.abc123
130
143
  pltr dataset files list ri.foundry.main.dataset.abc123
131
144
 
145
+ # Dataset transaction management
146
+ pltr dataset transactions start ri.foundry.main.dataset.abc123
147
+ pltr dataset transactions commit ri.foundry.main.dataset.abc123 <transaction-rid>
148
+ pltr dataset files upload myfile.csv ri.foundry.main.dataset.abc123 --transaction-rid <rid>
149
+
132
150
  # Start interactive mode for exploration
133
151
  pltr shell
134
152
  ```
@@ -171,6 +189,13 @@ pltr sql execute "SELECT * FROM table" # Run SQL queries
171
189
  pltr ontology list # List ontologies
172
190
  pltr dataset get <rid> # Get dataset info
173
191
 
192
+ # Filesystem Management
193
+ pltr folder create "My Project" # Create folders
194
+ pltr space create "Team Space" <org-rid> # Create spaces
195
+ pltr project create "New Project" <space-rid> # Create projects
196
+ pltr resource search "dataset name" # Search resources
197
+ pltr resource-role grant <resource-rid> <user-id> User viewer # Grant permissions
198
+
174
199
  # Orchestration
175
200
  pltr orchestration builds search # Search builds
176
201
  pltr orchestration jobs get <job-rid> # Get job details
@@ -181,6 +206,12 @@ pltr media-sets get <set-rid> <item-rid> # Get media item info
181
206
  pltr media-sets upload <set-rid> file.jpg "/path/file.jpg" <txn-id> # Upload media
182
207
  pltr media-sets download <set-rid> <item-rid> output.jpg # Download media
183
208
 
209
+ # Connectivity & Data Imports
210
+ pltr connectivity connection list # List available connections
211
+ pltr connectivity connection get <conn-rid> # Get connection details
212
+ pltr connectivity import file <conn-rid> <source-path> <dataset-rid> --execute # Import file
213
+ pltr connectivity import table <conn-rid> <table-name> <dataset-rid> --execute # Import table
214
+
184
215
  # Administrative
185
216
  pltr admin user current # Current user info
186
217
  pltr admin user list # List users
@@ -301,6 +332,74 @@ pltr media-sets download ri.mediasets.main.media-set.abc \
301
332
  - Preview mode (`--preview`)
302
333
  - Transaction-based upload workflow
303
334
 
335
+ ### 📊 Dataset Transaction Management
336
+
337
+ pltr-cli provides comprehensive transaction management for datasets, allowing atomic operations with rollback capability:
338
+
339
+ #### Transaction Lifecycle
340
+ ```bash
341
+ # Start a new transaction
342
+ pltr dataset transactions start ri.foundry.main.dataset.abc123 --branch master --type APPEND
343
+ # Returns transaction RID for use in subsequent operations
344
+
345
+ # Check transaction status
346
+ pltr dataset transactions status ri.foundry.main.dataset.abc123 ri.foundry.main.transaction.xyz
347
+
348
+ # List all transactions for a dataset
349
+ pltr dataset transactions list ri.foundry.main.dataset.abc123 --branch master
350
+
351
+ # Commit a transaction (make changes permanent)
352
+ pltr dataset transactions commit ri.foundry.main.dataset.abc123 ri.foundry.main.transaction.xyz
353
+
354
+ # Abort a transaction (discard all changes)
355
+ pltr dataset transactions abort ri.foundry.main.dataset.abc123 ri.foundry.main.transaction.xyz --yes
356
+ ```
357
+
358
+ #### File Operations with Transactions
359
+ ```bash
360
+ # Upload files within a transaction
361
+ pltr dataset files upload data.csv ri.foundry.main.dataset.abc123 \
362
+ --transaction-rid ri.foundry.main.transaction.xyz
363
+
364
+ # Multiple file uploads in same transaction
365
+ pltr dataset files upload file1.csv ri.foundry.main.dataset.abc123 \
366
+ --transaction-rid ri.foundry.main.transaction.xyz
367
+ pltr dataset files upload file2.csv ri.foundry.main.dataset.abc123 \
368
+ --transaction-rid ri.foundry.main.transaction.xyz
369
+
370
+ # Commit when ready
371
+ pltr dataset transactions commit ri.foundry.main.dataset.abc123 ri.foundry.main.transaction.xyz
372
+ ```
373
+
374
+ #### Transaction Types
375
+ - **APPEND**: Add new files to dataset
376
+ - **UPDATE**: Add new files and overwrite existing ones
377
+ - **SNAPSHOT**: Replace entire dataset with new files
378
+ - **DELETE**: Remove files from dataset
379
+
380
+ #### Example Workflow
381
+ ```bash
382
+ # Start a transaction for bulk data update
383
+ TRANSACTION=$(pltr dataset transactions start ri.foundry.main.dataset.abc123 \
384
+ --type UPDATE --format json | jq -r '.transaction_rid')
385
+
386
+ # Upload multiple files
387
+ pltr dataset files upload data1.csv ri.foundry.main.dataset.abc123 --transaction-rid $TRANSACTION
388
+ pltr dataset files upload data2.csv ri.foundry.main.dataset.abc123 --transaction-rid $TRANSACTION
389
+
390
+ # Check status before committing
391
+ pltr dataset transactions status ri.foundry.main.dataset.abc123 $TRANSACTION
392
+
393
+ # Commit if everything looks good
394
+ pltr dataset transactions commit ri.foundry.main.dataset.abc123 $TRANSACTION
395
+ ```
396
+
397
+ **Benefits:**
398
+ - **Data Integrity**: Atomic operations with rollback capability
399
+ - **Error Recovery**: Clean rollback from failed operations
400
+ - **Collaboration**: Better concurrent modification handling
401
+ - **Automation**: Reliable data pipeline operations
402
+
304
403
  ## ⚙️ Configuration
305
404
 
306
405
  pltr-cli stores configuration securely using industry best practices:
@@ -1,6 +1,6 @@
1
- pltr/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
1
+ pltr/__init__.py,sha256=isJrmDBLRag7Zc2UK9ZovWGOv7ji1Oh-zJtJMNJFkXw,22
2
2
  pltr/__main__.py,sha256=HWJ49UoAYBQCf8kjuySPmBTuUjTZrOx-y6PzMTyS1KE,879
3
- pltr/cli.py,sha256=EIW67XC8-AttN6S2OUxaxEC2trYDxaHVy8j18G92EzU,2191
3
+ pltr/cli.py,sha256=DikRsWsU7QWvRWHgB6wZIct916ebWyaub7PlAjKJXws,2664
4
4
  pltr/auth/__init__.py,sha256=G0V-Rh25FaJsH2nhrf146XQQG_ApdbyPJNuHJC25kgk,38
5
5
  pltr/auth/base.py,sha256=LvmCwS7A0q0CITcym8udPzdACL52_jSGusiaeCTOaE8,981
6
6
  pltr/auth/manager.py,sha256=ZqlGefr1a8MGx0g7kkQhpmiuVp0XTg3f43yMBCk-IRo,4305
@@ -12,12 +12,17 @@ pltr/commands/admin.py,sha256=foscSO-QuH6uggUR5Rmv9pTqGjEXTUzpmMFj2-8hEJs,17065
12
12
  pltr/commands/alias.py,sha256=r9xMsQNrGvaixSlspzoO2IXQ44LFXuZM4itt8vC0dRc,6862
13
13
  pltr/commands/completion.py,sha256=YTxaRL4-rDs5n7aXf3ogFsxbHVJUBo_HiBbd0fbBPZ0,10870
14
14
  pltr/commands/configure.py,sha256=oYj-VlOEj3MDwtB2RC4bYOYzI_sXTanPnz7y1GmMTqY,4800
15
- pltr/commands/dataset.py,sha256=3QWqClosXna7cpUxOQ93mNIYTAoHMReeePCdzY44lEk,14112
15
+ pltr/commands/connectivity.py,sha256=m8_BYwHij_5IbrYFTU_SYYtbqLCjxA8VIQpbdlWJqHs,14758
16
+ pltr/commands/dataset.py,sha256=6NiFnWkV_Tkx9AunV-dns6BeR_BBUNMg4tOocBBxaqI,24188
16
17
  pltr/commands/folder.py,sha256=IAPPA3Smk1IWqThneEtZ08Zp79vDKVUabSkL_nDvUWk,10679
17
18
  pltr/commands/mediasets.py,sha256=FXq7OtYU9wLgUxQFcS_fkA4i_CozGnsYKxh8GOSI0ok,15342
18
19
  pltr/commands/ontology.py,sha256=zUgSrmv8xi26SQK7GsM3qusgR9Wuka0GyzE7L8DkduE,18317
19
20
  pltr/commands/orchestration.py,sha256=4gq5nb43bU0Ub3iaKV-EgXT_ka8ilwdyxY_9M5iS84s,21958
21
+ pltr/commands/project.py,sha256=nlfyy4OYkYK9rtjOQp9awgCnSJ1P6sgsp0vaXdvkHFY,14183
22
+ pltr/commands/resource.py,sha256=VQsDSdeHlLoind34DU9dKu13tqSvsCUtYzxwDYULXSA,16384
23
+ pltr/commands/resource_role.py,sha256=pM0DQxLBU9xyIYzLv1Y0sOMZG5oZ1INNSkMubYBGHJM,15394
20
24
  pltr/commands/shell.py,sha256=QLF7TEGpaau9i0A9s3VjnegvtHde-SLRqI4suJFT4WI,3622
25
+ pltr/commands/space.py,sha256=R9TN9OQVDtFB92DOjrh81_YYajiQaqRNELsBHK4O-pI,21944
21
26
  pltr/commands/sql.py,sha256=wol0Rlvi_RplCFbOg4LCa3VXsOqmRZdFFVv7V6iVkh8,12602
22
27
  pltr/commands/verify.py,sha256=n8LWhbfGieYa-a5_l3MxqkYbdpyVf8-i0FQIL__AaPA,6650
23
28
  pltr/config/__init__.py,sha256=Y6gARy5lUHy-OJaOUxtfXoeQVNZV5QHLl6uKHQ8tpTk,41
@@ -27,19 +32,24 @@ pltr/config/settings.py,sha256=bfIiosPqH_W73TOHS71DvgZdAHka4fJDopU1SvBRFuQ,2908
27
32
  pltr/services/__init__.py,sha256=zQpgrqPdAkZI-nobi33mctU2-iGNgazzvjBVY8YRbSQ,101
28
33
  pltr/services/admin.py,sha256=8FjExmDeIKeVqkAxM83SVvpp_pH9W-Q33cgVs6BHxLQ,9957
29
34
  pltr/services/base.py,sha256=R2G781FI-sXtjUyLd91bVnmLb4cYZI3G8U5ndR9NLA4,1593
30
- pltr/services/dataset.py,sha256=cjl3aUhFcmWz_4ED8_h-Fl4Ym8ZMuA0dolOh89M7ufc,15412
35
+ pltr/services/connectivity.py,sha256=34kazXhue5gNi1_2s2R5Ma4VQe6jP25CO-ztiPhCeZw,10548
36
+ pltr/services/dataset.py,sha256=OeKRkkTRT_3uALsvipVzaFIOYRatqXUxLbLkbyCiqLc,20478
31
37
  pltr/services/folder.py,sha256=mWElyvn-wXPB5sv8Ik_dLeW5JM6jZg3g9KKBk6UcrlQ,5389
32
38
  pltr/services/mediasets.py,sha256=HgHNFWoG9r-5xupANVOxHg_h5EKsBDl6PsO8hwdbm28,9854
33
39
  pltr/services/ontology.py,sha256=iW7qRK8ptlw-u4eAwLNC-mdzLoLZzh7SRqJyok2c3GU,14883
34
40
  pltr/services/orchestration.py,sha256=t5RNC0BoKcqeYKJQ5AQAyyO_dIYCHxiHV177JVSszhM,14729
41
+ pltr/services/project.py,sha256=nwLXBX0MWgOnVQ7CAZQHnzZtSJY_hqlGyooFngQSjcc,7740
42
+ pltr/services/resource.py,sha256=hX1DX5ZoVx8-ZImBitHqgMS8Ver022RoMbd4ZvCt-fA,9603
43
+ pltr/services/resource_role.py,sha256=Ootor16c6PR9TNxe6KJyd4W2lYM_HHDxJk-JvZhgRxU,10608
44
+ pltr/services/space.py,sha256=4uea1nQ6CA-6_xWoD6n49E4Zm6KbW_7Cq9o89JorMTE,11544
35
45
  pltr/services/sql.py,sha256=19cscjlzN8WE1s8_ctiRcrOvMzCfmWRj49vjJ8Gs5Q4,11286
36
46
  pltr/utils/__init__.py,sha256=DF7TigL1XbKVGM5VjgU8_8AGIszofkdO80oCzLGGnTE,38
37
47
  pltr/utils/alias_resolver.py,sha256=DIF7P1UnUU8kqocJfIDEWjYq4s8_0KfqRZBbECeZEh8,1539
38
48
  pltr/utils/completion.py,sha256=bjeqjleEfB2YcQFpcxvF0GoQ763F6KBbULSZC4FWY_g,4980
39
- pltr/utils/formatting.py,sha256=uI8pkcWsO15kSH3xiOU9WxHCVfiWADEi-W1ldiXsCRY,40383
49
+ pltr/utils/formatting.py,sha256=MuIgi8dSqvhzik7H0YQOq1sYPnY_poZOYeTVvrIY2Jk,44235
40
50
  pltr/utils/progress.py,sha256=BKYbiLO61uhQbibabU7pxvvbAWMRLRmqk4pZldBQK_g,9053
41
- pltr_cli-0.5.0.dist-info/METADATA,sha256=TNVMhHGMRkuRcWfds_6y4B9h6vDSkBRMr9Gt-IeYvks,13356
42
- pltr_cli-0.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- pltr_cli-0.5.0.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
44
- pltr_cli-0.5.0.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
45
- pltr_cli-0.5.0.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,,