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/__init__.py +1 -1
- pltr/cli.py +14 -0
- pltr/commands/connectivity.py +432 -0
- pltr/commands/dataset.py +268 -0
- pltr/commands/project.py +440 -0
- pltr/commands/resource.py +499 -0
- pltr/commands/resource_role.py +454 -0
- pltr/commands/space.py +662 -0
- pltr/services/connectivity.py +305 -0
- pltr/services/dataset.py +149 -15
- pltr/services/project.py +232 -0
- pltr/services/resource.py +289 -0
- pltr/services/resource_role.py +321 -0
- pltr/services/space.py +354 -0
- pltr/utils/formatting.py +108 -1
- {pltr_cli-0.5.0.dist-info → pltr_cli-0.5.2.dist-info}/METADATA +101 -2
- {pltr_cli-0.5.0.dist-info → pltr_cli-0.5.2.dist-info}/RECORD +20 -10
- {pltr_cli-0.5.0.dist-info → pltr_cli-0.5.2.dist-info}/WHEEL +0 -0
- {pltr_cli-0.5.0.dist-info → pltr_cli-0.5.2.dist-info}/entry_points.txt +0 -0
- {pltr_cli-0.5.0.dist-info → pltr_cli-0.5.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Connectivity service wrapper for Foundry SDK.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional, Dict, List
|
|
6
|
+
|
|
7
|
+
from .base import BaseService
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ConnectivityService(BaseService):
|
|
11
|
+
"""Service wrapper for Foundry connectivity operations."""
|
|
12
|
+
|
|
13
|
+
def _get_service(self) -> Any:
|
|
14
|
+
"""Get the Foundry client for connectivity operations."""
|
|
15
|
+
return self.client
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def connections_service(self) -> Any:
|
|
19
|
+
"""Get the connections service from the client."""
|
|
20
|
+
return self.client.connections
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def file_imports_service(self) -> Any:
|
|
24
|
+
"""Get the file imports service from the client."""
|
|
25
|
+
return self.client.file_imports
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def table_imports_service(self) -> Any:
|
|
29
|
+
"""Get the table imports service from the client."""
|
|
30
|
+
return self.client.table_imports
|
|
31
|
+
|
|
32
|
+
def list_connections(self) -> List[Dict[str, Any]]:
|
|
33
|
+
"""
|
|
34
|
+
List available connections.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
List of connection information dictionaries
|
|
38
|
+
"""
|
|
39
|
+
try:
|
|
40
|
+
connections = self.connections_service.Connection.list()
|
|
41
|
+
return [self._format_connection_info(conn) for conn in connections]
|
|
42
|
+
except Exception as e:
|
|
43
|
+
raise RuntimeError(f"Failed to list connections: {e}")
|
|
44
|
+
|
|
45
|
+
def get_connection(self, connection_rid: str) -> Dict[str, Any]:
|
|
46
|
+
"""
|
|
47
|
+
Get information about a specific connection.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
connection_rid: Connection Resource Identifier
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Connection information dictionary
|
|
54
|
+
"""
|
|
55
|
+
try:
|
|
56
|
+
connection = self.connections_service.Connection.get(connection_rid)
|
|
57
|
+
return self._format_connection_info(connection)
|
|
58
|
+
except Exception as e:
|
|
59
|
+
raise RuntimeError(f"Failed to get connection {connection_rid}: {e}")
|
|
60
|
+
|
|
61
|
+
def create_file_import(
|
|
62
|
+
self,
|
|
63
|
+
connection_rid: str,
|
|
64
|
+
source_path: str,
|
|
65
|
+
target_dataset_rid: str,
|
|
66
|
+
import_config: Optional[Dict[str, Any]] = None,
|
|
67
|
+
) -> Dict[str, Any]:
|
|
68
|
+
"""
|
|
69
|
+
Create a file import via connection.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
connection_rid: Connection Resource Identifier
|
|
73
|
+
source_path: Path to source file in the connection
|
|
74
|
+
target_dataset_rid: Target dataset RID
|
|
75
|
+
import_config: Optional import configuration
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
File import information dictionary
|
|
79
|
+
"""
|
|
80
|
+
try:
|
|
81
|
+
config = import_config or {}
|
|
82
|
+
file_import = self.file_imports_service.FileImport.create(
|
|
83
|
+
connection_rid=connection_rid,
|
|
84
|
+
source_path=source_path,
|
|
85
|
+
target_dataset_rid=target_dataset_rid,
|
|
86
|
+
**config,
|
|
87
|
+
)
|
|
88
|
+
return self._format_import_info(file_import)
|
|
89
|
+
except Exception as e:
|
|
90
|
+
raise RuntimeError(
|
|
91
|
+
f"Failed to create file import from {connection_rid}:{source_path}: {e}"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def get_file_import(self, import_rid: str) -> Dict[str, Any]:
|
|
95
|
+
"""
|
|
96
|
+
Get information about a specific file import.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
import_rid: File import Resource Identifier
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
File import information dictionary
|
|
103
|
+
"""
|
|
104
|
+
try:
|
|
105
|
+
file_import = self.file_imports_service.FileImport.get(import_rid)
|
|
106
|
+
return self._format_import_info(file_import)
|
|
107
|
+
except Exception as e:
|
|
108
|
+
raise RuntimeError(f"Failed to get file import {import_rid}: {e}")
|
|
109
|
+
|
|
110
|
+
def execute_file_import(self, import_rid: str) -> Dict[str, Any]:
|
|
111
|
+
"""
|
|
112
|
+
Execute a file import.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
import_rid: File import Resource Identifier
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Execution result information
|
|
119
|
+
"""
|
|
120
|
+
try:
|
|
121
|
+
result = self.file_imports_service.FileImport.execute(import_rid)
|
|
122
|
+
return self._format_execution_result(result)
|
|
123
|
+
except Exception as e:
|
|
124
|
+
raise RuntimeError(f"Failed to execute file import {import_rid}: {e}")
|
|
125
|
+
|
|
126
|
+
def create_table_import(
|
|
127
|
+
self,
|
|
128
|
+
connection_rid: str,
|
|
129
|
+
source_table: str,
|
|
130
|
+
target_dataset_rid: str,
|
|
131
|
+
import_config: Optional[Dict[str, Any]] = None,
|
|
132
|
+
) -> Dict[str, Any]:
|
|
133
|
+
"""
|
|
134
|
+
Create a table import via connection.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
connection_rid: Connection Resource Identifier
|
|
138
|
+
source_table: Source table name in the connection
|
|
139
|
+
target_dataset_rid: Target dataset RID
|
|
140
|
+
import_config: Optional import configuration
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
Table import information dictionary
|
|
144
|
+
"""
|
|
145
|
+
try:
|
|
146
|
+
config = import_config or {}
|
|
147
|
+
table_import = self.table_imports_service.TableImport.create(
|
|
148
|
+
connection_rid=connection_rid,
|
|
149
|
+
source_table=source_table,
|
|
150
|
+
target_dataset_rid=target_dataset_rid,
|
|
151
|
+
**config,
|
|
152
|
+
)
|
|
153
|
+
return self._format_import_info(table_import)
|
|
154
|
+
except Exception as e:
|
|
155
|
+
raise RuntimeError(
|
|
156
|
+
f"Failed to create table import from {connection_rid}:{source_table}: {e}"
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
def get_table_import(self, import_rid: str) -> Dict[str, Any]:
|
|
160
|
+
"""
|
|
161
|
+
Get information about a specific table import.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
import_rid: Table import Resource Identifier
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Table import information dictionary
|
|
168
|
+
"""
|
|
169
|
+
try:
|
|
170
|
+
table_import = self.table_imports_service.TableImport.get(import_rid)
|
|
171
|
+
return self._format_import_info(table_import)
|
|
172
|
+
except Exception as e:
|
|
173
|
+
raise RuntimeError(f"Failed to get table import {import_rid}: {e}")
|
|
174
|
+
|
|
175
|
+
def execute_table_import(self, import_rid: str) -> Dict[str, Any]:
|
|
176
|
+
"""
|
|
177
|
+
Execute a table import.
|
|
178
|
+
|
|
179
|
+
Args:
|
|
180
|
+
import_rid: Table import Resource Identifier
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
Execution result information
|
|
184
|
+
"""
|
|
185
|
+
try:
|
|
186
|
+
result = self.table_imports_service.TableImport.execute(import_rid)
|
|
187
|
+
return self._format_execution_result(result)
|
|
188
|
+
except Exception as e:
|
|
189
|
+
raise RuntimeError(f"Failed to execute table import {import_rid}: {e}")
|
|
190
|
+
|
|
191
|
+
def list_file_imports(
|
|
192
|
+
self, connection_rid: Optional[str] = None
|
|
193
|
+
) -> List[Dict[str, Any]]:
|
|
194
|
+
"""
|
|
195
|
+
List file imports, optionally filtered by connection.
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
connection_rid: Optional connection RID to filter by
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
List of file import information dictionaries
|
|
202
|
+
"""
|
|
203
|
+
try:
|
|
204
|
+
if connection_rid:
|
|
205
|
+
imports = self.file_imports_service.FileImport.list(
|
|
206
|
+
connection_rid=connection_rid
|
|
207
|
+
)
|
|
208
|
+
else:
|
|
209
|
+
imports = self.file_imports_service.FileImport.list()
|
|
210
|
+
return [self._format_import_info(imp) for imp in imports]
|
|
211
|
+
except Exception as e:
|
|
212
|
+
raise RuntimeError(f"Failed to list file imports: {e}")
|
|
213
|
+
|
|
214
|
+
def list_table_imports(
|
|
215
|
+
self, connection_rid: Optional[str] = None
|
|
216
|
+
) -> List[Dict[str, Any]]:
|
|
217
|
+
"""
|
|
218
|
+
List table imports, optionally filtered by connection.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
connection_rid: Optional connection RID to filter by
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
List of table import information dictionaries
|
|
225
|
+
"""
|
|
226
|
+
try:
|
|
227
|
+
if connection_rid:
|
|
228
|
+
imports = self.table_imports_service.TableImport.list(
|
|
229
|
+
connection_rid=connection_rid
|
|
230
|
+
)
|
|
231
|
+
else:
|
|
232
|
+
imports = self.table_imports_service.TableImport.list()
|
|
233
|
+
return [self._format_import_info(imp) for imp in imports]
|
|
234
|
+
except Exception as e:
|
|
235
|
+
raise RuntimeError(f"Failed to list table imports: {e}")
|
|
236
|
+
|
|
237
|
+
def _format_connection_info(self, connection: Any) -> Dict[str, Any]:
|
|
238
|
+
"""
|
|
239
|
+
Format connection information for display.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
connection: Connection object from SDK
|
|
243
|
+
|
|
244
|
+
Returns:
|
|
245
|
+
Formatted connection dictionary
|
|
246
|
+
"""
|
|
247
|
+
try:
|
|
248
|
+
return {
|
|
249
|
+
"rid": getattr(connection, "rid", "N/A"),
|
|
250
|
+
"display_name": getattr(connection, "display_name", "N/A"),
|
|
251
|
+
"description": getattr(connection, "description", ""),
|
|
252
|
+
"connection_type": getattr(connection, "connection_type", "N/A"),
|
|
253
|
+
"status": getattr(connection, "status", "N/A"),
|
|
254
|
+
"created_time": getattr(connection, "created_time", "N/A"),
|
|
255
|
+
"modified_time": getattr(connection, "modified_time", "N/A"),
|
|
256
|
+
}
|
|
257
|
+
except Exception:
|
|
258
|
+
return {"raw": str(connection)}
|
|
259
|
+
|
|
260
|
+
def _format_import_info(self, import_obj: Any) -> Dict[str, Any]:
|
|
261
|
+
"""
|
|
262
|
+
Format import information for display.
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
import_obj: Import object from SDK
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
Formatted import dictionary
|
|
269
|
+
"""
|
|
270
|
+
try:
|
|
271
|
+
return {
|
|
272
|
+
"rid": getattr(import_obj, "rid", "N/A"),
|
|
273
|
+
"display_name": getattr(import_obj, "display_name", "N/A"),
|
|
274
|
+
"connection_rid": getattr(import_obj, "connection_rid", "N/A"),
|
|
275
|
+
"target_dataset_rid": getattr(import_obj, "target_dataset_rid", "N/A"),
|
|
276
|
+
"status": getattr(import_obj, "status", "N/A"),
|
|
277
|
+
"import_type": getattr(import_obj, "import_type", "N/A"),
|
|
278
|
+
"source": getattr(import_obj, "source", "N/A"),
|
|
279
|
+
"created_time": getattr(import_obj, "created_time", "N/A"),
|
|
280
|
+
"modified_time": getattr(import_obj, "modified_time", "N/A"),
|
|
281
|
+
}
|
|
282
|
+
except Exception:
|
|
283
|
+
return {"raw": str(import_obj)}
|
|
284
|
+
|
|
285
|
+
def _format_execution_result(self, result: Any) -> Dict[str, Any]:
|
|
286
|
+
"""
|
|
287
|
+
Format execution result for display.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
result: Execution result object from SDK
|
|
291
|
+
|
|
292
|
+
Returns:
|
|
293
|
+
Formatted result dictionary
|
|
294
|
+
"""
|
|
295
|
+
try:
|
|
296
|
+
return {
|
|
297
|
+
"execution_rid": getattr(result, "execution_rid", "N/A"),
|
|
298
|
+
"status": getattr(result, "status", "N/A"),
|
|
299
|
+
"started_time": getattr(result, "started_time", "N/A"),
|
|
300
|
+
"completed_time": getattr(result, "completed_time", ""),
|
|
301
|
+
"records_processed": getattr(result, "records_processed", 0),
|
|
302
|
+
"errors": getattr(result, "errors", []),
|
|
303
|
+
}
|
|
304
|
+
except Exception:
|
|
305
|
+
return {"raw": str(result)}
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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.
|
|
200
|
-
dataset_rid=dataset_rid, file_path=file_path,
|
|
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.
|
|
237
|
+
files = self.service.Dataset.File.list(
|
|
238
|
+
dataset_rid=dataset_rid, branch_name=branch
|
|
239
|
+
)
|
|
240
240
|
|
|
241
241
|
return [
|
|
242
242
|
{
|
|
@@ -307,6 +307,135 @@ class DatasetService(BaseService):
|
|
|
307
307
|
f"Failed to create branch '{branch_name}' for dataset {dataset_rid}: {e}"
|
|
308
308
|
)
|
|
309
309
|
|
|
310
|
+
def create_transaction(
|
|
311
|
+
self, dataset_rid: str, branch: str = "master", transaction_type: str = "APPEND"
|
|
312
|
+
) -> Dict[str, Any]:
|
|
313
|
+
"""
|
|
314
|
+
Create a new transaction for a dataset.
|
|
315
|
+
|
|
316
|
+
Args:
|
|
317
|
+
dataset_rid: Dataset Resource Identifier
|
|
318
|
+
branch: Dataset branch name
|
|
319
|
+
transaction_type: Transaction type (APPEND, UPDATE, SNAPSHOT, DELETE)
|
|
320
|
+
|
|
321
|
+
Returns:
|
|
322
|
+
Transaction information dictionary
|
|
323
|
+
"""
|
|
324
|
+
try:
|
|
325
|
+
# Use the v2 API's Dataset.Transaction.create method
|
|
326
|
+
transaction = self.service.Dataset.Transaction.create(
|
|
327
|
+
dataset_rid=dataset_rid,
|
|
328
|
+
transaction_type=transaction_type,
|
|
329
|
+
branch_name=branch,
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
return {
|
|
333
|
+
"transaction_rid": getattr(transaction, "rid", None),
|
|
334
|
+
"dataset_rid": dataset_rid,
|
|
335
|
+
"branch": branch,
|
|
336
|
+
"transaction_type": transaction_type,
|
|
337
|
+
"status": getattr(transaction, "status", "OPEN"),
|
|
338
|
+
"created_time": getattr(transaction, "created_time", None),
|
|
339
|
+
"created_by": getattr(transaction, "created_by", None),
|
|
340
|
+
}
|
|
341
|
+
except Exception as e:
|
|
342
|
+
raise RuntimeError(
|
|
343
|
+
f"Failed to create transaction for dataset {dataset_rid}: {e}"
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
def commit_transaction(
|
|
347
|
+
self, dataset_rid: str, transaction_rid: str
|
|
348
|
+
) -> Dict[str, Any]:
|
|
349
|
+
"""
|
|
350
|
+
Commit an open transaction.
|
|
351
|
+
|
|
352
|
+
Args:
|
|
353
|
+
dataset_rid: Dataset Resource Identifier
|
|
354
|
+
transaction_rid: Transaction Resource Identifier
|
|
355
|
+
|
|
356
|
+
Returns:
|
|
357
|
+
Transaction commit result
|
|
358
|
+
"""
|
|
359
|
+
try:
|
|
360
|
+
# Use the v2 API Dataset.Transaction.commit method
|
|
361
|
+
self.service.Dataset.Transaction.commit(
|
|
362
|
+
dataset_rid=dataset_rid, transaction_rid=transaction_rid
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
return {
|
|
366
|
+
"transaction_rid": transaction_rid,
|
|
367
|
+
"dataset_rid": dataset_rid,
|
|
368
|
+
"status": "COMMITTED",
|
|
369
|
+
"committed_time": None, # Would need to get this from a status call
|
|
370
|
+
"success": True,
|
|
371
|
+
}
|
|
372
|
+
except Exception as e:
|
|
373
|
+
raise RuntimeError(f"Failed to commit transaction {transaction_rid}: {e}")
|
|
374
|
+
|
|
375
|
+
def abort_transaction(
|
|
376
|
+
self, dataset_rid: str, transaction_rid: str
|
|
377
|
+
) -> Dict[str, Any]:
|
|
378
|
+
"""
|
|
379
|
+
Abort an open transaction.
|
|
380
|
+
|
|
381
|
+
Args:
|
|
382
|
+
dataset_rid: Dataset Resource Identifier
|
|
383
|
+
transaction_rid: Transaction Resource Identifier
|
|
384
|
+
|
|
385
|
+
Returns:
|
|
386
|
+
Transaction abort result
|
|
387
|
+
"""
|
|
388
|
+
try:
|
|
389
|
+
# Use the v2 API Dataset.Transaction.abort method
|
|
390
|
+
self.service.Dataset.Transaction.abort(
|
|
391
|
+
dataset_rid=dataset_rid, transaction_rid=transaction_rid
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
return {
|
|
395
|
+
"transaction_rid": transaction_rid,
|
|
396
|
+
"dataset_rid": dataset_rid,
|
|
397
|
+
"status": "ABORTED",
|
|
398
|
+
"aborted_time": None, # Would need to get this from a status call
|
|
399
|
+
"success": True,
|
|
400
|
+
}
|
|
401
|
+
except Exception as e:
|
|
402
|
+
raise RuntimeError(f"Failed to abort transaction {transaction_rid}: {e}")
|
|
403
|
+
|
|
404
|
+
def get_transaction_status(
|
|
405
|
+
self, dataset_rid: str, transaction_rid: str
|
|
406
|
+
) -> Dict[str, Any]:
|
|
407
|
+
"""
|
|
408
|
+
Get the status of a specific transaction.
|
|
409
|
+
|
|
410
|
+
Args:
|
|
411
|
+
dataset_rid: Dataset Resource Identifier
|
|
412
|
+
transaction_rid: Transaction Resource Identifier
|
|
413
|
+
|
|
414
|
+
Returns:
|
|
415
|
+
Transaction status information
|
|
416
|
+
"""
|
|
417
|
+
try:
|
|
418
|
+
# Use the v2 API Dataset.Transaction.get method
|
|
419
|
+
transaction = self.service.Dataset.Transaction.get(
|
|
420
|
+
dataset_rid=dataset_rid, transaction_rid=transaction_rid
|
|
421
|
+
)
|
|
422
|
+
|
|
423
|
+
return {
|
|
424
|
+
"transaction_rid": transaction_rid,
|
|
425
|
+
"dataset_rid": dataset_rid,
|
|
426
|
+
"status": getattr(transaction, "status", None),
|
|
427
|
+
"transaction_type": getattr(transaction, "transaction_type", None),
|
|
428
|
+
"branch": getattr(transaction, "branch", None),
|
|
429
|
+
"created_time": getattr(transaction, "created_time", None),
|
|
430
|
+
"created_by": getattr(transaction, "created_by", None),
|
|
431
|
+
"committed_time": getattr(transaction, "committed_time", None),
|
|
432
|
+
"aborted_time": getattr(transaction, "aborted_time", None),
|
|
433
|
+
}
|
|
434
|
+
except Exception as e:
|
|
435
|
+
raise RuntimeError(
|
|
436
|
+
f"Failed to get transaction status {transaction_rid}: {e}"
|
|
437
|
+
)
|
|
438
|
+
|
|
310
439
|
def get_transactions(
|
|
311
440
|
self, dataset_rid: str, branch: str = "master"
|
|
312
441
|
) -> List[Dict[str, Any]]:
|
|
@@ -321,17 +450,22 @@ class DatasetService(BaseService):
|
|
|
321
450
|
List of transaction information dictionaries
|
|
322
451
|
"""
|
|
323
452
|
try:
|
|
324
|
-
#
|
|
325
|
-
|
|
326
|
-
|
|
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
|
|
327
457
|
)
|
|
328
458
|
|
|
329
459
|
return [
|
|
330
460
|
{
|
|
331
461
|
"transaction_rid": getattr(transaction, "rid", None),
|
|
462
|
+
"status": getattr(transaction, "status", None),
|
|
463
|
+
"transaction_type": getattr(transaction, "transaction_type", None),
|
|
464
|
+
"branch": getattr(transaction, "branch", branch),
|
|
332
465
|
"created_time": getattr(transaction, "created_time", None),
|
|
333
466
|
"created_by": getattr(transaction, "created_by", None),
|
|
334
|
-
"
|
|
467
|
+
"committed_time": getattr(transaction, "committed_time", None),
|
|
468
|
+
"aborted_time": getattr(transaction, "aborted_time", None),
|
|
335
469
|
}
|
|
336
470
|
for transaction in transactions
|
|
337
471
|
]
|