pvw-cli 1.0.12__py3-none-any.whl → 1.2.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.
Potentially problematic release.
This version of pvw-cli might be problematic. Click here for more details.
- purviewcli/__init__.py +2 -2
- purviewcli/cli/account.py +24 -24
- purviewcli/cli/cli.py +16 -16
- purviewcli/cli/collections.py +24 -24
- purviewcli/cli/domain.py +8 -8
- purviewcli/cli/entity.py +328 -222
- purviewcli/cli/glossary.py +29 -29
- purviewcli/cli/health.py +2 -2
- purviewcli/cli/insight.py +7 -7
- purviewcli/cli/lineage.py +11 -11
- purviewcli/cli/unified_catalog.py +610 -29
- purviewcli/cli/workflow.py +43 -43
- purviewcli/client/_entity.py +35 -0
- purviewcli/client/_unified_catalog.py +7 -0
- {pvw_cli-1.0.12.dist-info → pvw_cli-1.2.0.dist-info}/METADATA +378 -58
- {pvw_cli-1.0.12.dist-info → pvw_cli-1.2.0.dist-info}/RECORD +19 -19
- {pvw_cli-1.0.12.dist-info → pvw_cli-1.2.0.dist-info}/WHEEL +0 -0
- {pvw_cli-1.0.12.dist-info → pvw_cli-1.2.0.dist-info}/entry_points.txt +0 -0
- {pvw_cli-1.0.12.dist-info → pvw_cli-1.2.0.dist-info}/top_level.txt +0 -0
purviewcli/cli/workflow.py
CHANGED
|
@@ -27,7 +27,7 @@ def list(ctx, output_json):
|
|
|
27
27
|
try:
|
|
28
28
|
if ctx.obj and ctx.obj.get("mock"):
|
|
29
29
|
console.print("[yellow]🎭 Mock: workflow list command[/yellow]")
|
|
30
|
-
console.print("[green]
|
|
30
|
+
console.print("[green][OK] Mock workflow list completed successfully[/green]")
|
|
31
31
|
return
|
|
32
32
|
|
|
33
33
|
from purviewcli.client._workflow import Workflow
|
|
@@ -46,7 +46,7 @@ def list(ctx, output_json):
|
|
|
46
46
|
workflows = []
|
|
47
47
|
|
|
48
48
|
if not workflows:
|
|
49
|
-
console.print("[yellow]
|
|
49
|
+
console.print("[yellow][!] No workflows found[/yellow]")
|
|
50
50
|
return
|
|
51
51
|
|
|
52
52
|
# Output in JSON format if requested
|
|
@@ -81,7 +81,7 @@ def list(ctx, output_json):
|
|
|
81
81
|
console.print(f"\n[dim]Total: {len(workflows)} workflow(s)[/dim]")
|
|
82
82
|
|
|
83
83
|
except Exception as e:
|
|
84
|
-
console.print(f"[red]
|
|
84
|
+
console.print(f"[red][X] Error executing workflow list: {str(e)}[/red]")
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
@workflow.command()
|
|
@@ -100,7 +100,7 @@ def create(ctx, workflow_id, payload_file):
|
|
|
100
100
|
console.print("[yellow]🎭 Mock: workflow create command[/yellow]")
|
|
101
101
|
console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
|
|
102
102
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
103
|
-
console.print("[green]
|
|
103
|
+
console.print("[green][OK] Mock workflow create completed successfully[/green]")
|
|
104
104
|
return
|
|
105
105
|
|
|
106
106
|
from purviewcli.client._workflow import Workflow
|
|
@@ -110,12 +110,12 @@ def create(ctx, workflow_id, payload_file):
|
|
|
110
110
|
result = workflow_client.workflowCreateWorkflow(args)
|
|
111
111
|
|
|
112
112
|
if result:
|
|
113
|
-
console.print("[green]
|
|
113
|
+
console.print("[green][OK] Workflow create completed successfully[/green]")
|
|
114
114
|
console.print(json.dumps(result, indent=2))
|
|
115
115
|
else:
|
|
116
|
-
console.print("[yellow]
|
|
116
|
+
console.print("[yellow][!] Workflow create completed with no result[/yellow]")
|
|
117
117
|
except Exception as e:
|
|
118
|
-
console.print(f"[red]
|
|
118
|
+
console.print(f"[red][X] Error executing workflow create: {str(e)}[/red]")
|
|
119
119
|
|
|
120
120
|
|
|
121
121
|
@workflow.command()
|
|
@@ -127,7 +127,7 @@ def get(ctx, workflow_id):
|
|
|
127
127
|
if ctx.obj and ctx.obj.get("mock"):
|
|
128
128
|
console.print("[yellow]🎭 Mock: workflow get command[/yellow]")
|
|
129
129
|
console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
|
|
130
|
-
console.print("[green]
|
|
130
|
+
console.print("[green][OK] Mock workflow get completed successfully[/green]")
|
|
131
131
|
return
|
|
132
132
|
|
|
133
133
|
from purviewcli.client._workflow import Workflow
|
|
@@ -137,12 +137,12 @@ def get(ctx, workflow_id):
|
|
|
137
137
|
result = workflow_client.workflowGetWorkflow(args)
|
|
138
138
|
|
|
139
139
|
if result:
|
|
140
|
-
console.print("[green]
|
|
140
|
+
console.print("[green][OK] Workflow get completed successfully[/green]")
|
|
141
141
|
console.print(json.dumps(result, indent=2))
|
|
142
142
|
else:
|
|
143
|
-
console.print("[yellow]
|
|
143
|
+
console.print("[yellow][!] Workflow not found[/yellow]")
|
|
144
144
|
except Exception as e:
|
|
145
|
-
console.print(f"[red]
|
|
145
|
+
console.print(f"[red][X] Error executing workflow get: {str(e)}[/red]")
|
|
146
146
|
|
|
147
147
|
|
|
148
148
|
@workflow.command()
|
|
@@ -159,7 +159,7 @@ def execute(ctx, workflow_id, payload_file):
|
|
|
159
159
|
console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
|
|
160
160
|
if payload_file:
|
|
161
161
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
162
|
-
console.print("[green]
|
|
162
|
+
console.print("[green][OK] Mock workflow execute completed successfully[/green]")
|
|
163
163
|
return
|
|
164
164
|
|
|
165
165
|
from purviewcli.client._workflow import Workflow
|
|
@@ -171,12 +171,12 @@ def execute(ctx, workflow_id, payload_file):
|
|
|
171
171
|
result = workflow_client.workflowExecuteWorkflow(args)
|
|
172
172
|
|
|
173
173
|
if result:
|
|
174
|
-
console.print("[green]
|
|
174
|
+
console.print("[green][OK] Workflow execute completed successfully[/green]")
|
|
175
175
|
console.print(json.dumps(result, indent=2))
|
|
176
176
|
else:
|
|
177
|
-
console.print("[yellow]
|
|
177
|
+
console.print("[yellow][!] Workflow execute completed with no result[/yellow]")
|
|
178
178
|
except Exception as e:
|
|
179
|
-
console.print(f"[red]
|
|
179
|
+
console.print(f"[red][X] Error executing workflow: {str(e)}[/red]")
|
|
180
180
|
|
|
181
181
|
|
|
182
182
|
@workflow.command()
|
|
@@ -188,7 +188,7 @@ def executions(ctx, workflow_id):
|
|
|
188
188
|
if ctx.obj and ctx.obj.get("mock"):
|
|
189
189
|
console.print("[yellow]🎭 Mock: workflow executions command[/yellow]")
|
|
190
190
|
console.print(f"[dim]Workflow ID: {workflow_id}[/dim]")
|
|
191
|
-
console.print("[green]
|
|
191
|
+
console.print("[green][OK] Mock workflow executions completed successfully[/green]")
|
|
192
192
|
return
|
|
193
193
|
|
|
194
194
|
from purviewcli.client._workflow import Workflow
|
|
@@ -198,12 +198,12 @@ def executions(ctx, workflow_id):
|
|
|
198
198
|
result = workflow_client.workflowListWorkflowExecutions(args)
|
|
199
199
|
|
|
200
200
|
if result:
|
|
201
|
-
console.print("[green]
|
|
201
|
+
console.print("[green][OK] Workflow executions list completed successfully[/green]")
|
|
202
202
|
console.print(json.dumps(result, indent=2))
|
|
203
203
|
else:
|
|
204
|
-
console.print("[yellow]
|
|
204
|
+
console.print("[yellow][!] No workflow executions found[/yellow]")
|
|
205
205
|
except Exception as e:
|
|
206
|
-
console.print(f"[red]
|
|
206
|
+
console.print(f"[red][X] Error listing workflow executions: {str(e)}[/red]")
|
|
207
207
|
|
|
208
208
|
|
|
209
209
|
# ========== Approval Commands ==========
|
|
@@ -222,7 +222,7 @@ def approvals(ctx, status, assigned_to):
|
|
|
222
222
|
console.print(f"[dim]Status Filter: {status}[/dim]")
|
|
223
223
|
if assigned_to:
|
|
224
224
|
console.print(f"[dim]Assigned To: {assigned_to}[/dim]")
|
|
225
|
-
console.print("[green]
|
|
225
|
+
console.print("[green][OK] Mock workflow approvals completed successfully[/green]")
|
|
226
226
|
return
|
|
227
227
|
|
|
228
228
|
from purviewcli.client._workflow import Workflow
|
|
@@ -236,12 +236,12 @@ def approvals(ctx, status, assigned_to):
|
|
|
236
236
|
result = workflow_client.workflowGetApprovalRequests(args)
|
|
237
237
|
|
|
238
238
|
if result:
|
|
239
|
-
console.print("[green]
|
|
239
|
+
console.print("[green][OK] Approval requests list completed successfully[/green]")
|
|
240
240
|
console.print(json.dumps(result, indent=2))
|
|
241
241
|
else:
|
|
242
|
-
console.print("[yellow]
|
|
242
|
+
console.print("[yellow][!] No approval requests found[/yellow]")
|
|
243
243
|
except Exception as e:
|
|
244
|
-
console.print(f"[red]
|
|
244
|
+
console.print(f"[red][X] Error listing approval requests: {str(e)}[/red]")
|
|
245
245
|
|
|
246
246
|
|
|
247
247
|
@workflow.command()
|
|
@@ -256,7 +256,7 @@ def approve(ctx, request_id, comments):
|
|
|
256
256
|
console.print(f"[dim]Request ID: {request_id}[/dim]")
|
|
257
257
|
if comments:
|
|
258
258
|
console.print(f"[dim]Comments: {comments}[/dim]")
|
|
259
|
-
console.print("[green]
|
|
259
|
+
console.print("[green][OK] Mock workflow approve completed successfully[/green]")
|
|
260
260
|
return
|
|
261
261
|
|
|
262
262
|
from purviewcli.client._workflow import Workflow
|
|
@@ -268,12 +268,12 @@ def approve(ctx, request_id, comments):
|
|
|
268
268
|
result = workflow_client.workflowApproveRequest(args)
|
|
269
269
|
|
|
270
270
|
if result:
|
|
271
|
-
console.print("[green]
|
|
271
|
+
console.print("[green][OK] Request approved successfully[/green]")
|
|
272
272
|
console.print(json.dumps(result, indent=2))
|
|
273
273
|
else:
|
|
274
|
-
console.print("[yellow]
|
|
274
|
+
console.print("[yellow][!] Request approval completed with no result[/yellow]")
|
|
275
275
|
except Exception as e:
|
|
276
|
-
console.print(f"[red]
|
|
276
|
+
console.print(f"[red][X] Error approving request: {str(e)}[/red]")
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
@workflow.command()
|
|
@@ -288,7 +288,7 @@ def reject(ctx, request_id, comments):
|
|
|
288
288
|
console.print(f"[dim]Request ID: {request_id}[/dim]")
|
|
289
289
|
if comments:
|
|
290
290
|
console.print(f"[dim]Comments: {comments}[/dim]")
|
|
291
|
-
console.print("[green]
|
|
291
|
+
console.print("[green][OK] Mock workflow reject completed successfully[/green]")
|
|
292
292
|
return
|
|
293
293
|
|
|
294
294
|
from purviewcli.client._workflow import Workflow
|
|
@@ -300,12 +300,12 @@ def reject(ctx, request_id, comments):
|
|
|
300
300
|
result = workflow_client.workflowRejectRequest(args)
|
|
301
301
|
|
|
302
302
|
if result:
|
|
303
|
-
console.print("[green]
|
|
303
|
+
console.print("[green][OK] Request rejected successfully[/green]")
|
|
304
304
|
console.print(json.dumps(result, indent=2))
|
|
305
305
|
else:
|
|
306
|
-
console.print("[yellow]
|
|
306
|
+
console.print("[yellow][!] Request rejection completed with no result[/yellow]")
|
|
307
307
|
except Exception as e:
|
|
308
|
-
console.print(f"[red]
|
|
308
|
+
console.print(f"[red][X] Error rejecting request: {str(e)}[/red]")
|
|
309
309
|
|
|
310
310
|
|
|
311
311
|
# ========== Template Commands ==========
|
|
@@ -318,7 +318,7 @@ def templates(ctx):
|
|
|
318
318
|
try:
|
|
319
319
|
if ctx.obj and ctx.obj.get("mock"):
|
|
320
320
|
console.print("[yellow]🎭 Mock: workflow templates command[/yellow]")
|
|
321
|
-
console.print("[green]
|
|
321
|
+
console.print("[green][OK] Mock workflow templates completed successfully[/green]")
|
|
322
322
|
return
|
|
323
323
|
|
|
324
324
|
from purviewcli.client._workflow import Workflow
|
|
@@ -328,12 +328,12 @@ def templates(ctx):
|
|
|
328
328
|
result = workflow_client.workflowListWorkflowTemplates(args)
|
|
329
329
|
|
|
330
330
|
if result:
|
|
331
|
-
console.print("[green]
|
|
331
|
+
console.print("[green][OK] Workflow templates list completed successfully[/green]")
|
|
332
332
|
console.print(json.dumps(result, indent=2))
|
|
333
333
|
else:
|
|
334
|
-
console.print("[yellow]
|
|
334
|
+
console.print("[yellow][!] No workflow templates found[/yellow]")
|
|
335
335
|
except Exception as e:
|
|
336
|
-
console.print(f"[red]
|
|
336
|
+
console.print(f"[red][X] Error listing workflow templates: {str(e)}[/red]")
|
|
337
337
|
|
|
338
338
|
|
|
339
339
|
@workflow.command()
|
|
@@ -345,7 +345,7 @@ def template(ctx, template_id):
|
|
|
345
345
|
if ctx.obj and ctx.obj.get("mock"):
|
|
346
346
|
console.print("[yellow]🎭 Mock: workflow template command[/yellow]")
|
|
347
347
|
console.print(f"[dim]Template ID: {template_id}[/dim]")
|
|
348
|
-
console.print("[green]
|
|
348
|
+
console.print("[green][OK] Mock workflow template completed successfully[/green]")
|
|
349
349
|
return
|
|
350
350
|
|
|
351
351
|
from purviewcli.client._workflow import Workflow
|
|
@@ -355,12 +355,12 @@ def template(ctx, template_id):
|
|
|
355
355
|
result = workflow_client.workflowGetWorkflowTemplate(args)
|
|
356
356
|
|
|
357
357
|
if result:
|
|
358
|
-
console.print("[green]
|
|
358
|
+
console.print("[green][OK] Workflow template get completed successfully[/green]")
|
|
359
359
|
console.print(json.dumps(result, indent=2))
|
|
360
360
|
else:
|
|
361
|
-
console.print("[yellow]
|
|
361
|
+
console.print("[yellow][!] Workflow template not found[/yellow]")
|
|
362
362
|
except Exception as e:
|
|
363
|
-
console.print(f"[red]
|
|
363
|
+
console.print(f"[red][X] Error getting workflow template: {str(e)}[/red]")
|
|
364
364
|
|
|
365
365
|
|
|
366
366
|
# ========== Validation Commands ==========
|
|
@@ -380,7 +380,7 @@ def validate(ctx, payload_file):
|
|
|
380
380
|
if ctx.obj and ctx.obj.get("mock"):
|
|
381
381
|
console.print("[yellow]🎭 Mock: workflow validate command[/yellow]")
|
|
382
382
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
383
|
-
console.print("[green]
|
|
383
|
+
console.print("[green][OK] Mock workflow validate completed successfully[/green]")
|
|
384
384
|
return
|
|
385
385
|
|
|
386
386
|
from purviewcli.client._workflow import Workflow
|
|
@@ -390,12 +390,12 @@ def validate(ctx, payload_file):
|
|
|
390
390
|
result = workflow_client.workflowValidateWorkflow(args)
|
|
391
391
|
|
|
392
392
|
if result:
|
|
393
|
-
console.print("[green]
|
|
393
|
+
console.print("[green][OK] Workflow validation completed successfully[/green]")
|
|
394
394
|
console.print(json.dumps(result, indent=2))
|
|
395
395
|
else:
|
|
396
|
-
console.print("[yellow]
|
|
396
|
+
console.print("[yellow][!] Workflow validation completed with no result[/yellow]")
|
|
397
397
|
except Exception as e:
|
|
398
|
-
console.print(f"[red]
|
|
398
|
+
console.print(f"[red][X] Error validating workflow: {str(e)}[/red]")
|
|
399
399
|
|
|
400
400
|
|
|
401
401
|
if __name__ == "__main__":
|
purviewcli/client/_entity.py
CHANGED
|
@@ -19,6 +19,41 @@ from .endpoint import Endpoint, decorator, get_json, no_api_call_decorator
|
|
|
19
19
|
from .endpoints import ENDPOINTS, get_api_version_params
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def map_flat_entity_to_purview_entity(row):
|
|
23
|
+
"""Map a flat row (pandas Series or dict) into a Purview entity dict.
|
|
24
|
+
|
|
25
|
+
Expected minimal input: { 'typeName': 'DataSet', 'qualifiedName': '...','attr1': 'v', ... }
|
|
26
|
+
Produces: { 'typeName': ..., 'attributes': { 'qualifiedName': ..., 'attr1': 'v', ... } }
|
|
27
|
+
"""
|
|
28
|
+
try:
|
|
29
|
+
data = row.to_dict()
|
|
30
|
+
except Exception:
|
|
31
|
+
data = dict(row)
|
|
32
|
+
|
|
33
|
+
# pop typeName
|
|
34
|
+
type_name = data.pop("typeName", None)
|
|
35
|
+
|
|
36
|
+
# build attributes, skipping null-like values
|
|
37
|
+
attrs = {}
|
|
38
|
+
from math import isnan
|
|
39
|
+
|
|
40
|
+
for k, v in data.items():
|
|
41
|
+
# skip empty column names
|
|
42
|
+
if k is None or (isinstance(k, str) and k.strip() == ""):
|
|
43
|
+
continue
|
|
44
|
+
# treat NaN/None as missing
|
|
45
|
+
try:
|
|
46
|
+
if v is None:
|
|
47
|
+
continue
|
|
48
|
+
if isinstance(v, float) and isnan(v):
|
|
49
|
+
continue
|
|
50
|
+
except Exception:
|
|
51
|
+
pass
|
|
52
|
+
attrs[k] = v
|
|
53
|
+
|
|
54
|
+
return {"typeName": type_name, "attributes": attrs}
|
|
55
|
+
|
|
56
|
+
|
|
22
57
|
class Entity(Endpoint):
|
|
23
58
|
"""Entity Management Operations - Complete Official API Implementation with 100% Coverage"""
|
|
24
59
|
|
|
@@ -411,6 +411,11 @@ class UnifiedCatalogClient(Endpoint):
|
|
|
411
411
|
"status": status,
|
|
412
412
|
}
|
|
413
413
|
|
|
414
|
+
# Add parent_id if provided
|
|
415
|
+
parent_id = args.get("--parent-id", [""])[0]
|
|
416
|
+
if parent_id:
|
|
417
|
+
payload["parentId"] = parent_id
|
|
418
|
+
|
|
414
419
|
# Add optional fields
|
|
415
420
|
if owners:
|
|
416
421
|
payload["contacts"] = {"owner": owners}
|
|
@@ -450,6 +455,8 @@ class UnifiedCatalogClient(Endpoint):
|
|
|
450
455
|
payload["description"] = args.get("--description", [""])[0]
|
|
451
456
|
if args.get("--governance-domain-id"):
|
|
452
457
|
payload["domain"] = args["--governance-domain-id"][0]
|
|
458
|
+
if args.get("--parent-id"):
|
|
459
|
+
payload["parentId"] = args["--parent-id"][0]
|
|
453
460
|
if args.get("--status"):
|
|
454
461
|
payload["status"] = args["--status"][0]
|
|
455
462
|
|