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/entity.py
CHANGED
|
@@ -47,7 +47,7 @@ def read(ctx, guid, ignore_relationships, min_ext_info):
|
|
|
47
47
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
48
48
|
console.print(f"[dim]Ignore Relationships: {ignore_relationships}[/dim]")
|
|
49
49
|
console.print(f"[dim]Min Ext Info: {min_ext_info}[/dim]")
|
|
50
|
-
console.print("[green]
|
|
50
|
+
console.print("[green][OK] Mock entity read completed successfully[/green]")
|
|
51
51
|
return
|
|
52
52
|
|
|
53
53
|
args = {
|
|
@@ -62,13 +62,13 @@ def read(ctx, guid, ignore_relationships, min_ext_info):
|
|
|
62
62
|
result = entity_client.entityRead(args)
|
|
63
63
|
|
|
64
64
|
if result:
|
|
65
|
-
console.print("[green]
|
|
65
|
+
console.print("[green][OK] Entity read completed successfully[/green]")
|
|
66
66
|
console.print(json.dumps(result, indent=2))
|
|
67
67
|
else:
|
|
68
|
-
console.print("[yellow]
|
|
68
|
+
console.print("[yellow][!] Entity read completed with no result[/yellow]")
|
|
69
69
|
|
|
70
70
|
except Exception as e:
|
|
71
|
-
console.print(f"[red]
|
|
71
|
+
console.print(f"[red][X] Error executing entity read: {str(e)}[/red]")
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
@entity.command()
|
|
@@ -85,7 +85,7 @@ def create(ctx, payload_file):
|
|
|
85
85
|
if ctx.obj.get("mock"):
|
|
86
86
|
console.print("[yellow]🎭 Mock: entity create command[/yellow]")
|
|
87
87
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
88
|
-
console.print("[green]
|
|
88
|
+
console.print("[green][OK] Mock entity create completed successfully[/green]")
|
|
89
89
|
return
|
|
90
90
|
|
|
91
91
|
args = {"--payloadFile": payload_file}
|
|
@@ -96,13 +96,13 @@ def create(ctx, payload_file):
|
|
|
96
96
|
result = entity_client.entityCreate(args)
|
|
97
97
|
|
|
98
98
|
if result:
|
|
99
|
-
console.print("[green]
|
|
99
|
+
console.print("[green][OK] Entity create completed successfully[/green]")
|
|
100
100
|
console.print(json.dumps(result, indent=2))
|
|
101
101
|
else:
|
|
102
|
-
console.print("[yellow]
|
|
102
|
+
console.print("[yellow][!] Entity create completed with no result[/yellow]")
|
|
103
103
|
|
|
104
104
|
except Exception as e:
|
|
105
|
-
console.print(f"[red]
|
|
105
|
+
console.print(f"[red][X] Error executing entity create: {str(e)}[/red]")
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
@entity.command()
|
|
@@ -114,7 +114,7 @@ def delete(ctx, guid):
|
|
|
114
114
|
if ctx.obj.get("mock"):
|
|
115
115
|
console.print("[yellow]🎭 Mock: entity delete command[/yellow]")
|
|
116
116
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
117
|
-
console.print("[green]
|
|
117
|
+
console.print("[green][OK] Mock entity delete completed successfully[/green]")
|
|
118
118
|
return
|
|
119
119
|
|
|
120
120
|
args = {"--guid": guid}
|
|
@@ -125,13 +125,13 @@ def delete(ctx, guid):
|
|
|
125
125
|
result = entity_client.entityDelete(args)
|
|
126
126
|
|
|
127
127
|
if result:
|
|
128
|
-
console.print("[green]
|
|
128
|
+
console.print("[green][OK] Entity delete completed successfully[/green]")
|
|
129
129
|
console.print(json.dumps(result, indent=2))
|
|
130
130
|
else:
|
|
131
|
-
console.print("[yellow]
|
|
131
|
+
console.print("[yellow][!] Entity delete completed with no result[/yellow]")
|
|
132
132
|
|
|
133
133
|
except Exception as e:
|
|
134
|
-
console.print(f"[red]
|
|
134
|
+
console.print(f"[red][X] Error executing entity delete: {str(e)}[/red]")
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
@entity.command()
|
|
@@ -148,7 +148,7 @@ def bulk_create(ctx, payload_file):
|
|
|
148
148
|
if ctx.obj.get("mock"):
|
|
149
149
|
console.print("[yellow]🎭 Mock: entity bulk-create command[/yellow]")
|
|
150
150
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
151
|
-
console.print("[green]
|
|
151
|
+
console.print("[green][OK] Mock entity bulk-create completed successfully[/green]")
|
|
152
152
|
return
|
|
153
153
|
|
|
154
154
|
args = {"--payloadFile": payload_file}
|
|
@@ -159,13 +159,13 @@ def bulk_create(ctx, payload_file):
|
|
|
159
159
|
result = entity_client.entityBulkCreateOrUpdate(args)
|
|
160
160
|
|
|
161
161
|
if result:
|
|
162
|
-
console.print("[green]
|
|
162
|
+
console.print("[green][OK] Entity bulk-create completed successfully[/green]")
|
|
163
163
|
console.print(json.dumps(result, indent=2))
|
|
164
164
|
else:
|
|
165
|
-
console.print("[yellow]
|
|
165
|
+
console.print("[yellow][!] Entity bulk-create completed with no result[/yellow]")
|
|
166
166
|
|
|
167
167
|
except Exception as e:
|
|
168
|
-
console.print(f"[red]
|
|
168
|
+
console.print(f"[red][X] Error executing entity bulk-create: {str(e)}[/red]")
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
@entity.command(name="bulk-update")
|
|
@@ -182,7 +182,7 @@ def bulk_update(ctx, payload_file):
|
|
|
182
182
|
if ctx.obj.get("mock"):
|
|
183
183
|
console.print("[yellow]🎭 Mock: entity bulk-update command[/yellow]")
|
|
184
184
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
185
|
-
console.print("[green]
|
|
185
|
+
console.print("[green][OK] Mock entity bulk-update completed successfully[/green]")
|
|
186
186
|
return
|
|
187
187
|
|
|
188
188
|
args = {"--payloadFile": payload_file}
|
|
@@ -193,13 +193,13 @@ def bulk_update(ctx, payload_file):
|
|
|
193
193
|
result = entity_client.entityBulkCreateOrUpdate(args)
|
|
194
194
|
|
|
195
195
|
if result:
|
|
196
|
-
console.print("[green]
|
|
196
|
+
console.print("[green][OK] Entity bulk-update completed successfully[/green]")
|
|
197
197
|
console.print(json.dumps(result, indent=2))
|
|
198
198
|
else:
|
|
199
|
-
console.print("[yellow]
|
|
199
|
+
console.print("[yellow][!] Entity bulk-update completed with no result[/yellow]")
|
|
200
200
|
|
|
201
201
|
except Exception as e:
|
|
202
|
-
console.print(f"[red]
|
|
202
|
+
console.print(f"[red][X] Error executing entity bulk-update: {str(e)}[/red]")
|
|
203
203
|
|
|
204
204
|
|
|
205
205
|
# === BULK OPERATIONS ===
|
|
@@ -224,7 +224,7 @@ def bulk_read(ctx, guid, ignore_relationships, min_ext_info):
|
|
|
224
224
|
if ctx.obj.get("mock"):
|
|
225
225
|
console.print("[yellow]🎭 Mock: entity bulk-read command[/yellow]")
|
|
226
226
|
console.print(f"[dim]GUIDs: {', '.join(guid)}[/dim]")
|
|
227
|
-
console.print("[green]
|
|
227
|
+
console.print("[green][OK] Mock entity bulk-read completed successfully[/green]")
|
|
228
228
|
return
|
|
229
229
|
|
|
230
230
|
args = {
|
|
@@ -239,13 +239,13 @@ def bulk_read(ctx, guid, ignore_relationships, min_ext_info):
|
|
|
239
239
|
result = entity_client.entityReadBulk(args)
|
|
240
240
|
|
|
241
241
|
if result:
|
|
242
|
-
console.print("[green]
|
|
242
|
+
console.print("[green][OK] Entity bulk-read completed successfully[/green]")
|
|
243
243
|
console.print(json.dumps(result, indent=2))
|
|
244
244
|
else:
|
|
245
|
-
console.print("[yellow]
|
|
245
|
+
console.print("[yellow][!] Entity bulk-read completed with no result[/yellow]")
|
|
246
246
|
|
|
247
247
|
except Exception as e:
|
|
248
|
-
console.print(f"[red]
|
|
248
|
+
console.print(f"[red][X] Error executing entity bulk-read: {str(e)}[/red]")
|
|
249
249
|
|
|
250
250
|
|
|
251
251
|
@entity.command()
|
|
@@ -259,7 +259,7 @@ def bulk_delete(ctx, guid):
|
|
|
259
259
|
if ctx.obj.get("mock"):
|
|
260
260
|
console.print("[yellow]🎭 Mock: entity bulk-delete command[/yellow]")
|
|
261
261
|
console.print(f"[dim]GUIDs: {', '.join(guid)}[/dim]")
|
|
262
|
-
console.print("[green]
|
|
262
|
+
console.print("[green][OK] Mock entity bulk-delete completed successfully[/green]")
|
|
263
263
|
return
|
|
264
264
|
|
|
265
265
|
args = {"--guid": list(guid)}
|
|
@@ -270,13 +270,13 @@ def bulk_delete(ctx, guid):
|
|
|
270
270
|
result = entity_client.entityDeleteBulk(args)
|
|
271
271
|
|
|
272
272
|
if result:
|
|
273
|
-
console.print("[green]
|
|
273
|
+
console.print("[green][OK] Entity bulk-delete completed successfully[/green]")
|
|
274
274
|
console.print(json.dumps(result, indent=2))
|
|
275
275
|
else:
|
|
276
|
-
console.print("[yellow]
|
|
276
|
+
console.print("[yellow][!] Entity bulk-delete completed with no result[/yellow]")
|
|
277
277
|
|
|
278
278
|
except Exception as e:
|
|
279
|
-
console.print(f"[red]
|
|
279
|
+
console.print(f"[red][X] Error executing entity bulk-delete: {str(e)}[/red]")
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
# === UNIQUE ATTRIBUTE OPERATIONS ===
|
|
@@ -300,7 +300,7 @@ def read_by_attribute(ctx, type_name, qualified_name, ignore_relationships, min_
|
|
|
300
300
|
if ctx.obj.get("mock"):
|
|
301
301
|
console.print("[yellow]🎭 Mock: entity read-by-attribute command[/yellow]")
|
|
302
302
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
303
|
-
console.print("[green]
|
|
303
|
+
console.print("[green][OK] Mock entity read-by-attribute completed successfully[/green]")
|
|
304
304
|
return
|
|
305
305
|
|
|
306
306
|
args = {
|
|
@@ -316,13 +316,13 @@ def read_by_attribute(ctx, type_name, qualified_name, ignore_relationships, min_
|
|
|
316
316
|
result = entity_client.entityReadUniqueAttribute(args)
|
|
317
317
|
|
|
318
318
|
if result:
|
|
319
|
-
console.print("[green]
|
|
319
|
+
console.print("[green][OK] Entity read-by-attribute completed successfully[/green]")
|
|
320
320
|
console.print(json.dumps(result, indent=2))
|
|
321
321
|
else:
|
|
322
|
-
console.print("[yellow]
|
|
322
|
+
console.print("[yellow][!] Entity read-by-attribute completed with no result[/yellow]")
|
|
323
323
|
|
|
324
324
|
except Exception as e:
|
|
325
|
-
console.print(f"[red]
|
|
325
|
+
console.print(f"[red][X] Error executing entity read-by-attribute: {str(e)}[/red]")
|
|
326
326
|
|
|
327
327
|
|
|
328
328
|
@entity.command()
|
|
@@ -348,7 +348,7 @@ def bulk_read_by_attribute(ctx, type_name, qualified_name, ignore_relationships,
|
|
|
348
348
|
f"[dim]Type: {type_name}, Qualified Names: {', '.join(qualified_name)}[/dim]"
|
|
349
349
|
)
|
|
350
350
|
console.print(
|
|
351
|
-
"[green]
|
|
351
|
+
"[green][OK] Mock entity bulk-read-by-attribute completed successfully[/green]"
|
|
352
352
|
)
|
|
353
353
|
return
|
|
354
354
|
|
|
@@ -365,15 +365,15 @@ def bulk_read_by_attribute(ctx, type_name, qualified_name, ignore_relationships,
|
|
|
365
365
|
result = entity_client.entityReadBulkUniqueAttribute(args)
|
|
366
366
|
|
|
367
367
|
if result:
|
|
368
|
-
console.print("[green]
|
|
368
|
+
console.print("[green][OK] Entity bulk-read-by-attribute completed successfully[/green]")
|
|
369
369
|
console.print(json.dumps(result, indent=2))
|
|
370
370
|
else:
|
|
371
371
|
console.print(
|
|
372
|
-
"[yellow]
|
|
372
|
+
"[yellow][!] Entity bulk-read-by-attribute completed with no result[/yellow]"
|
|
373
373
|
)
|
|
374
374
|
|
|
375
375
|
except Exception as e:
|
|
376
|
-
console.print(f"[red]
|
|
376
|
+
console.print(f"[red][X] Error executing entity bulk-read-by-attribute: {str(e)}[/red]")
|
|
377
377
|
|
|
378
378
|
|
|
379
379
|
@entity.command()
|
|
@@ -386,7 +386,7 @@ def delete_by_attribute(ctx, type_name, qualified_name):
|
|
|
386
386
|
if ctx.obj.get("mock"):
|
|
387
387
|
console.print("[yellow]🎭 Mock: entity delete-by-attribute command[/yellow]")
|
|
388
388
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
389
|
-
console.print("[green]
|
|
389
|
+
console.print("[green][OK] Mock entity delete-by-attribute completed successfully[/green]")
|
|
390
390
|
return
|
|
391
391
|
|
|
392
392
|
args = {
|
|
@@ -400,13 +400,13 @@ def delete_by_attribute(ctx, type_name, qualified_name):
|
|
|
400
400
|
result = entity_client.entityDeleteUniqueAttribute(args)
|
|
401
401
|
|
|
402
402
|
if result:
|
|
403
|
-
console.print("[green]
|
|
403
|
+
console.print("[green][OK] Entity delete-by-attribute completed successfully[/green]")
|
|
404
404
|
console.print(json.dumps(result, indent=2))
|
|
405
405
|
else:
|
|
406
|
-
console.print("[yellow]
|
|
406
|
+
console.print("[yellow][!] Entity delete-by-attribute completed with no result[/yellow]")
|
|
407
407
|
|
|
408
408
|
except Exception as e:
|
|
409
|
-
console.print(f"[red]
|
|
409
|
+
console.print(f"[red][X] Error executing entity delete-by-attribute: {str(e)}[/red]")
|
|
410
410
|
|
|
411
411
|
|
|
412
412
|
@entity.command()
|
|
@@ -425,7 +425,7 @@ def update_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
425
425
|
if ctx.obj.get("mock"):
|
|
426
426
|
console.print("[yellow]🎭 Mock: entity update-by-attribute command[/yellow]")
|
|
427
427
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
428
|
-
console.print("[green]
|
|
428
|
+
console.print("[green][OK] Mock entity update-by-attribute completed successfully[/green]")
|
|
429
429
|
return
|
|
430
430
|
|
|
431
431
|
args = {
|
|
@@ -440,13 +440,13 @@ def update_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
440
440
|
result = entity_client.entityPartialUpdateByUniqueAttribute(args)
|
|
441
441
|
|
|
442
442
|
if result:
|
|
443
|
-
console.print("[green]
|
|
443
|
+
console.print("[green][OK] Entity update-by-attribute completed successfully[/green]")
|
|
444
444
|
console.print(json.dumps(result, indent=2))
|
|
445
445
|
else:
|
|
446
|
-
console.print("[yellow]
|
|
446
|
+
console.print("[yellow][!] Entity update-by-attribute completed with no result[/yellow]")
|
|
447
447
|
|
|
448
448
|
except Exception as e:
|
|
449
|
-
console.print(f"[red]
|
|
449
|
+
console.print(f"[red][X] Error executing entity update-by-attribute: {str(e)}[/red]")
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
# === HEADER OPERATIONS ===
|
|
@@ -461,7 +461,7 @@ def read_header(ctx, guid):
|
|
|
461
461
|
if ctx.obj.get("mock"):
|
|
462
462
|
console.print("[yellow]🎭 Mock: entity read-header command[/yellow]")
|
|
463
463
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
464
|
-
console.print("[green]
|
|
464
|
+
console.print("[green][OK] Mock entity read-header completed successfully[/green]")
|
|
465
465
|
return
|
|
466
466
|
|
|
467
467
|
args = {"--guid": [guid]}
|
|
@@ -472,13 +472,13 @@ def read_header(ctx, guid):
|
|
|
472
472
|
result = entity_client.entityReadHeader(args)
|
|
473
473
|
|
|
474
474
|
if result:
|
|
475
|
-
console.print("[green]
|
|
475
|
+
console.print("[green][OK] Entity read-header completed successfully[/green]")
|
|
476
476
|
console.print(json.dumps(result, indent=2))
|
|
477
477
|
else:
|
|
478
|
-
console.print("[yellow]
|
|
478
|
+
console.print("[yellow][!] Entity read-header completed with no result[/yellow]")
|
|
479
479
|
|
|
480
480
|
except Exception as e:
|
|
481
|
-
console.print(f"[red]
|
|
481
|
+
console.print(f"[red][X] Error executing entity read-header: {str(e)}[/red]")
|
|
482
482
|
|
|
483
483
|
|
|
484
484
|
@entity.command()
|
|
@@ -492,7 +492,7 @@ def update_attribute(ctx, guid, attr_name, attr_value):
|
|
|
492
492
|
if ctx.obj.get("mock"):
|
|
493
493
|
console.print("[yellow]🎭 Mock: entity update-attribute command[/yellow]")
|
|
494
494
|
console.print(f"[dim]GUID: {guid}, Attribute: {attr_name}, Value: {attr_value}[/dim]")
|
|
495
|
-
console.print("[green]
|
|
495
|
+
console.print("[green][OK] Mock entity update-attribute completed successfully[/green]")
|
|
496
496
|
return
|
|
497
497
|
|
|
498
498
|
args = {
|
|
@@ -507,13 +507,13 @@ def update_attribute(ctx, guid, attr_name, attr_value):
|
|
|
507
507
|
result = entity_client.entityPartialUpdateAttribute(args)
|
|
508
508
|
|
|
509
509
|
if result:
|
|
510
|
-
console.print("[green]
|
|
510
|
+
console.print("[green][OK] Entity update-attribute completed successfully[/green]")
|
|
511
511
|
console.print(json.dumps(result, indent=2))
|
|
512
512
|
else:
|
|
513
|
-
console.print("[yellow]
|
|
513
|
+
console.print("[yellow][!] Entity update-attribute completed with no result[/yellow]")
|
|
514
514
|
|
|
515
515
|
except Exception as e:
|
|
516
|
-
console.print(f"[red]
|
|
516
|
+
console.print(f"[red][X] Error executing entity update-attribute: {str(e)}[/red]")
|
|
517
517
|
|
|
518
518
|
|
|
519
519
|
# === CLASSIFICATION OPERATIONS ===
|
|
@@ -529,7 +529,7 @@ def read_classification(ctx, guid, classification_name):
|
|
|
529
529
|
if ctx.obj.get("mock"):
|
|
530
530
|
console.print("[yellow]🎭 Mock: entity read-classification command[/yellow]")
|
|
531
531
|
console.print(f"[dim]GUID: {guid}, Classification: {classification_name}[/dim]")
|
|
532
|
-
console.print("[green]
|
|
532
|
+
console.print("[green][OK] Mock entity read-classification completed successfully[/green]")
|
|
533
533
|
return
|
|
534
534
|
|
|
535
535
|
args = {
|
|
@@ -543,13 +543,13 @@ def read_classification(ctx, guid, classification_name):
|
|
|
543
543
|
result = entity_client.entityReadClassification(args)
|
|
544
544
|
|
|
545
545
|
if result:
|
|
546
|
-
console.print("[green]
|
|
546
|
+
console.print("[green][OK] Entity read-classification completed successfully[/green]")
|
|
547
547
|
console.print(json.dumps(result, indent=2))
|
|
548
548
|
else:
|
|
549
|
-
console.print("[yellow]
|
|
549
|
+
console.print("[yellow][!] Entity read-classification completed with no result[/yellow]")
|
|
550
550
|
|
|
551
551
|
except Exception as e:
|
|
552
|
-
console.print(f"[red]
|
|
552
|
+
console.print(f"[red][X] Error executing entity read-classification: {str(e)}[/red]")
|
|
553
553
|
|
|
554
554
|
|
|
555
555
|
@entity.command()
|
|
@@ -562,7 +562,7 @@ def read_classifications(ctx, guid):
|
|
|
562
562
|
console.print("[yellow]🎭 Mock: entity read-classifications command[/yellow]")
|
|
563
563
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
564
564
|
console.print(
|
|
565
|
-
"[green]
|
|
565
|
+
"[green][OK] Mock entity read-classifications completed successfully[/green]"
|
|
566
566
|
)
|
|
567
567
|
return
|
|
568
568
|
|
|
@@ -574,13 +574,13 @@ def read_classifications(ctx, guid):
|
|
|
574
574
|
result = entity_client.entityReadClassifications(args)
|
|
575
575
|
|
|
576
576
|
if result:
|
|
577
|
-
console.print("[green]
|
|
577
|
+
console.print("[green][OK] Entity read-classifications completed successfully[/green]")
|
|
578
578
|
console.print(json.dumps(result, indent=2))
|
|
579
579
|
else:
|
|
580
|
-
console.print("[yellow]
|
|
580
|
+
console.print("[yellow][!] Entity read-classifications completed with no result[/yellow]")
|
|
581
581
|
|
|
582
582
|
except Exception as e:
|
|
583
|
-
console.print(f"[red]
|
|
583
|
+
console.print(f"[red][X] Error executing entity read-classifications: {str(e)}[/red]")
|
|
584
584
|
|
|
585
585
|
|
|
586
586
|
@entity.command()
|
|
@@ -598,7 +598,7 @@ def add_classifications(ctx, guid, payload_file):
|
|
|
598
598
|
if ctx.obj.get("mock"):
|
|
599
599
|
console.print("[yellow]🎭 Mock: entity add-classifications command[/yellow]")
|
|
600
600
|
console.print(f"[dim]GUID: {guid}, Payload File: {payload_file}[/dim]")
|
|
601
|
-
console.print("[green]
|
|
601
|
+
console.print("[green][OK] Mock entity add-classifications completed successfully[/green]")
|
|
602
602
|
return
|
|
603
603
|
|
|
604
604
|
args = {
|
|
@@ -612,13 +612,13 @@ def add_classifications(ctx, guid, payload_file):
|
|
|
612
612
|
result = entity_client.entityAddClassifications(args)
|
|
613
613
|
|
|
614
614
|
if result:
|
|
615
|
-
console.print("[green]
|
|
615
|
+
console.print("[green][OK] Entity add-classifications completed successfully[/green]")
|
|
616
616
|
console.print(json.dumps(result, indent=2))
|
|
617
617
|
else:
|
|
618
|
-
console.print("[yellow]
|
|
618
|
+
console.print("[yellow][!] Entity add-classifications completed with no result[/yellow]")
|
|
619
619
|
|
|
620
620
|
except Exception as e:
|
|
621
|
-
console.print(f"[red]
|
|
621
|
+
console.print(f"[red][X] Error executing entity add-classifications: {str(e)}[/red]")
|
|
622
622
|
|
|
623
623
|
|
|
624
624
|
@entity.command()
|
|
@@ -637,7 +637,7 @@ def update_classifications(ctx, guid, payload_file):
|
|
|
637
637
|
console.print("[yellow]🎭 Mock: entity update-classifications command[/yellow]")
|
|
638
638
|
console.print(f"[dim]GUID: {guid}, Payload File: {payload_file}[/dim]")
|
|
639
639
|
console.print(
|
|
640
|
-
"[green]
|
|
640
|
+
"[green][OK] Mock entity update-classifications completed successfully[/green]"
|
|
641
641
|
)
|
|
642
642
|
return
|
|
643
643
|
|
|
@@ -652,15 +652,15 @@ def update_classifications(ctx, guid, payload_file):
|
|
|
652
652
|
result = entity_client.entityUpdateClassifications(args)
|
|
653
653
|
|
|
654
654
|
if result:
|
|
655
|
-
console.print("[green]
|
|
655
|
+
console.print("[green][OK] Entity update-classifications completed successfully[/green]")
|
|
656
656
|
console.print(json.dumps(result, indent=2))
|
|
657
657
|
else:
|
|
658
658
|
console.print(
|
|
659
|
-
"[yellow]
|
|
659
|
+
"[yellow][!] Entity update-classifications completed with no result[/yellow]"
|
|
660
660
|
)
|
|
661
661
|
|
|
662
662
|
except Exception as e:
|
|
663
|
-
console.print(f"[red]
|
|
663
|
+
console.print(f"[red][X] Error executing entity update-classifications: {str(e)}[/red]")
|
|
664
664
|
|
|
665
665
|
|
|
666
666
|
@entity.command()
|
|
@@ -676,7 +676,7 @@ def remove_classification(ctx, guid, classification_name):
|
|
|
676
676
|
console.print("[yellow]🎭 Mock: entity remove-classification command[/yellow]")
|
|
677
677
|
console.print(f"[dim]GUID: {guid}, Classification: {classification_name}[/dim]")
|
|
678
678
|
console.print(
|
|
679
|
-
"[green]
|
|
679
|
+
"[green][OK] Mock entity remove-classification completed successfully[/green]"
|
|
680
680
|
)
|
|
681
681
|
return
|
|
682
682
|
|
|
@@ -691,15 +691,15 @@ def remove_classification(ctx, guid, classification_name):
|
|
|
691
691
|
result = entity_client.entityDeleteClassification(args)
|
|
692
692
|
|
|
693
693
|
if result:
|
|
694
|
-
console.print("[green]
|
|
694
|
+
console.print("[green][OK] Entity remove-classification completed successfully[/green]")
|
|
695
695
|
console.print(json.dumps(result, indent=2))
|
|
696
696
|
else:
|
|
697
697
|
console.print(
|
|
698
|
-
"[yellow]
|
|
698
|
+
"[yellow][!] Entity remove-classification completed with no result[/yellow]"
|
|
699
699
|
)
|
|
700
700
|
|
|
701
701
|
except Exception as e:
|
|
702
|
-
console.print(f"[red]
|
|
702
|
+
console.print(f"[red][X] Error executing entity remove-classification: {str(e)}[/red]")
|
|
703
703
|
|
|
704
704
|
|
|
705
705
|
# === CLASSIFICATION OPERATIONS BY UNIQUE ATTRIBUTE ===
|
|
@@ -724,7 +724,7 @@ def add_classifications_by_attribute(ctx, type_name, qualified_name, payload_fil
|
|
|
724
724
|
)
|
|
725
725
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
726
726
|
console.print(
|
|
727
|
-
"[green]
|
|
727
|
+
"[green][OK] Mock entity add-classifications-by-attribute completed successfully[/green]"
|
|
728
728
|
)
|
|
729
729
|
return
|
|
730
730
|
|
|
@@ -741,17 +741,17 @@ def add_classifications_by_attribute(ctx, type_name, qualified_name, payload_fil
|
|
|
741
741
|
|
|
742
742
|
if result:
|
|
743
743
|
console.print(
|
|
744
|
-
"[green]
|
|
744
|
+
"[green][OK] Entity add-classifications-by-attribute completed successfully[/green]"
|
|
745
745
|
)
|
|
746
746
|
console.print(json.dumps(result, indent=2))
|
|
747
747
|
else:
|
|
748
748
|
console.print(
|
|
749
|
-
"[yellow]
|
|
749
|
+
"[yellow][!] Entity add-classifications-by-attribute completed with no result[/yellow]"
|
|
750
750
|
)
|
|
751
751
|
|
|
752
752
|
except Exception as e:
|
|
753
753
|
console.print(
|
|
754
|
-
f"[red]
|
|
754
|
+
f"[red][X] Error executing entity add-classifications-by-attribute: {str(e)}[/red]"
|
|
755
755
|
)
|
|
756
756
|
|
|
757
757
|
|
|
@@ -774,7 +774,7 @@ def update_classifications_by_attribute(ctx, type_name, qualified_name, payload_
|
|
|
774
774
|
)
|
|
775
775
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
776
776
|
console.print(
|
|
777
|
-
"[green]
|
|
777
|
+
"[green][OK] Mock entity update-classifications-by-attribute completed successfully[/green]"
|
|
778
778
|
)
|
|
779
779
|
return
|
|
780
780
|
|
|
@@ -791,17 +791,17 @@ def update_classifications_by_attribute(ctx, type_name, qualified_name, payload_
|
|
|
791
791
|
|
|
792
792
|
if result:
|
|
793
793
|
console.print(
|
|
794
|
-
"[green]
|
|
794
|
+
"[green][OK] Entity update-classifications-by-attribute completed successfully[/green]"
|
|
795
795
|
)
|
|
796
796
|
console.print(json.dumps(result, indent=2))
|
|
797
797
|
else:
|
|
798
798
|
console.print(
|
|
799
|
-
"[yellow]
|
|
799
|
+
"[yellow][!] Entity update-classifications-by-attribute completed with no result[/yellow]"
|
|
800
800
|
)
|
|
801
801
|
|
|
802
802
|
except Exception as e:
|
|
803
803
|
console.print(
|
|
804
|
-
f"[red]
|
|
804
|
+
f"[red][X] Error executing entity update-classifications-by-attribute: {str(e)}[/red]"
|
|
805
805
|
)
|
|
806
806
|
|
|
807
807
|
|
|
@@ -823,7 +823,7 @@ def remove_classification_by_attribute(ctx, type_name, qualified_name, classific
|
|
|
823
823
|
f"[dim]Type: {type_name}, Qualified Name: {qualified_name}, Classification: {classification_name}[/dim]"
|
|
824
824
|
)
|
|
825
825
|
console.print(
|
|
826
|
-
"[green]
|
|
826
|
+
"[green][OK] Mock entity remove-classification-by-attribute completed successfully[/green]"
|
|
827
827
|
)
|
|
828
828
|
return
|
|
829
829
|
|
|
@@ -840,17 +840,17 @@ def remove_classification_by_attribute(ctx, type_name, qualified_name, classific
|
|
|
840
840
|
|
|
841
841
|
if result:
|
|
842
842
|
console.print(
|
|
843
|
-
"[green]
|
|
843
|
+
"[green][OK] Entity remove-classification-by-attribute completed successfully[/green]"
|
|
844
844
|
)
|
|
845
845
|
console.print(json.dumps(result, indent=2))
|
|
846
846
|
else:
|
|
847
847
|
console.print(
|
|
848
|
-
"[yellow]
|
|
848
|
+
"[yellow][!] Entity remove-classification-by-attribute completed with no result[/yellow]"
|
|
849
849
|
)
|
|
850
850
|
|
|
851
851
|
except Exception as e:
|
|
852
852
|
console.print(
|
|
853
|
-
f"[red]
|
|
853
|
+
f"[red][X] Error executing entity remove-classification-by-attribute: {str(e)}[/red]"
|
|
854
854
|
)
|
|
855
855
|
|
|
856
856
|
|
|
@@ -872,7 +872,7 @@ def bulk_add_classification(ctx, payload_file):
|
|
|
872
872
|
console.print("[yellow]🎭 Mock: entity bulk-add-classification command[/yellow]")
|
|
873
873
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
874
874
|
console.print(
|
|
875
|
-
"[green]
|
|
875
|
+
"[green][OK] Mock entity bulk-add-classification completed successfully[/green]"
|
|
876
876
|
)
|
|
877
877
|
return
|
|
878
878
|
|
|
@@ -884,15 +884,15 @@ def bulk_add_classification(ctx, payload_file):
|
|
|
884
884
|
result = entity_client.entityAddClassification(args)
|
|
885
885
|
|
|
886
886
|
if result:
|
|
887
|
-
console.print("[green]
|
|
887
|
+
console.print("[green][OK] Entity bulk-add-classification completed successfully[/green]")
|
|
888
888
|
console.print(json.dumps(result, indent=2))
|
|
889
889
|
else:
|
|
890
890
|
console.print(
|
|
891
|
-
"[yellow]
|
|
891
|
+
"[yellow][!] Entity bulk-add-classification completed with no result[/yellow]"
|
|
892
892
|
)
|
|
893
893
|
|
|
894
894
|
except Exception as e:
|
|
895
|
-
console.print(f"[red]
|
|
895
|
+
console.print(f"[red][X] Error executing entity bulk-add-classification: {str(e)}[/red]")
|
|
896
896
|
|
|
897
897
|
|
|
898
898
|
@entity.command()
|
|
@@ -910,7 +910,7 @@ def bulk_set_classifications(ctx, payload_file):
|
|
|
910
910
|
console.print("[yellow]🎭 Mock: entity bulk-set-classifications command[/yellow]")
|
|
911
911
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
912
912
|
console.print(
|
|
913
|
-
"[green]
|
|
913
|
+
"[green][OK] Mock entity bulk-set-classifications completed successfully[/green]"
|
|
914
914
|
)
|
|
915
915
|
return
|
|
916
916
|
|
|
@@ -922,15 +922,15 @@ def bulk_set_classifications(ctx, payload_file):
|
|
|
922
922
|
result = entity_client.entityBulkSetClassifications(args)
|
|
923
923
|
|
|
924
924
|
if result:
|
|
925
|
-
console.print("[green]
|
|
925
|
+
console.print("[green][OK] Entity bulk-set-classifications completed successfully[/green]")
|
|
926
926
|
console.print(json.dumps(result, indent=2))
|
|
927
927
|
else:
|
|
928
928
|
console.print(
|
|
929
|
-
"[yellow]
|
|
929
|
+
"[yellow][!] Entity bulk-set-classifications completed with no result[/yellow]"
|
|
930
930
|
)
|
|
931
931
|
|
|
932
932
|
except Exception as e:
|
|
933
|
-
console.print(f"[red]
|
|
933
|
+
console.print(f"[red][X] Error executing entity bulk-set-classifications: {str(e)}[/red]")
|
|
934
934
|
|
|
935
935
|
|
|
936
936
|
# === LABEL OPERATIONS ===
|
|
@@ -951,7 +951,7 @@ def add_labels(ctx, guid, payload_file):
|
|
|
951
951
|
if ctx.obj.get("mock"):
|
|
952
952
|
console.print("[yellow]🎭 Mock: entity add-labels command[/yellow]")
|
|
953
953
|
console.print(f"[dim]GUID: {guid}, Payload File: {payload_file}[/dim]")
|
|
954
|
-
console.print("[green]
|
|
954
|
+
console.print("[green][OK] Mock entity add-labels completed successfully[/green]")
|
|
955
955
|
return
|
|
956
956
|
|
|
957
957
|
args = {
|
|
@@ -965,13 +965,13 @@ def add_labels(ctx, guid, payload_file):
|
|
|
965
965
|
result = entity_client.entityAddLabels(args)
|
|
966
966
|
|
|
967
967
|
if result:
|
|
968
|
-
console.print("[green]
|
|
968
|
+
console.print("[green][OK] Entity add-labels completed successfully[/green]")
|
|
969
969
|
console.print(json.dumps(result, indent=2))
|
|
970
970
|
else:
|
|
971
|
-
console.print("[yellow]
|
|
971
|
+
console.print("[yellow][!] Entity add-labels completed with no result[/yellow]")
|
|
972
972
|
|
|
973
973
|
except Exception as e:
|
|
974
|
-
console.print(f"[red]
|
|
974
|
+
console.print(f"[red][X] Error executing entity add-labels: {str(e)}[/red]")
|
|
975
975
|
|
|
976
976
|
|
|
977
977
|
@entity.command()
|
|
@@ -989,7 +989,7 @@ def set_labels(ctx, guid, payload_file):
|
|
|
989
989
|
if ctx.obj.get("mock"):
|
|
990
990
|
console.print("[yellow]🎭 Mock: entity set-labels command[/yellow]")
|
|
991
991
|
console.print(f"[dim]GUID: {guid}, Payload File: {payload_file}[/dim]")
|
|
992
|
-
console.print("[green]
|
|
992
|
+
console.print("[green][OK] Mock entity set-labels completed successfully[/green]")
|
|
993
993
|
return
|
|
994
994
|
|
|
995
995
|
args = {
|
|
@@ -1003,13 +1003,13 @@ def set_labels(ctx, guid, payload_file):
|
|
|
1003
1003
|
result = entity_client.entitySetLabels(args)
|
|
1004
1004
|
|
|
1005
1005
|
if result:
|
|
1006
|
-
console.print("[green]
|
|
1006
|
+
console.print("[green][OK] Entity set-labels completed successfully[/green]")
|
|
1007
1007
|
console.print(json.dumps(result, indent=2))
|
|
1008
1008
|
else:
|
|
1009
|
-
console.print("[yellow]
|
|
1009
|
+
console.print("[yellow][!] Entity set-labels completed with no result[/yellow]")
|
|
1010
1010
|
|
|
1011
1011
|
except Exception as e:
|
|
1012
|
-
console.print(f"[red]
|
|
1012
|
+
console.print(f"[red][X] Error executing entity set-labels: {str(e)}[/red]")
|
|
1013
1013
|
|
|
1014
1014
|
|
|
1015
1015
|
@entity.command()
|
|
@@ -1027,7 +1027,7 @@ def remove_labels(ctx, guid, payload_file):
|
|
|
1027
1027
|
if ctx.obj.get("mock"):
|
|
1028
1028
|
console.print("[yellow]🎭 Mock: entity remove-labels command[/yellow]")
|
|
1029
1029
|
console.print(f"[dim]GUID: {guid}, Payload File: {payload_file}[/dim]")
|
|
1030
|
-
console.print("[green]
|
|
1030
|
+
console.print("[green][OK] Mock entity remove-labels completed successfully[/green]")
|
|
1031
1031
|
return
|
|
1032
1032
|
|
|
1033
1033
|
args = {
|
|
@@ -1041,13 +1041,13 @@ def remove_labels(ctx, guid, payload_file):
|
|
|
1041
1041
|
result = entity_client.entityRemoveLabels(args)
|
|
1042
1042
|
|
|
1043
1043
|
if result:
|
|
1044
|
-
console.print("[green]
|
|
1044
|
+
console.print("[green][OK] Entity remove-labels completed successfully[/green]")
|
|
1045
1045
|
console.print(json.dumps(result, indent=2))
|
|
1046
1046
|
else:
|
|
1047
|
-
console.print("[yellow]
|
|
1047
|
+
console.print("[yellow][!] Entity remove-labels completed with no result[/yellow]")
|
|
1048
1048
|
|
|
1049
1049
|
except Exception as e:
|
|
1050
|
-
console.print(f"[red]
|
|
1050
|
+
console.print(f"[red][X] Error executing entity remove-labels: {str(e)}[/red]")
|
|
1051
1051
|
|
|
1052
1052
|
|
|
1053
1053
|
# === LABEL OPERATIONS BY UNIQUE ATTRIBUTE ===
|
|
@@ -1070,7 +1070,7 @@ def add_labels_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
1070
1070
|
console.print("[yellow]🎭 Mock: entity add-labels-by-attribute command[/yellow]")
|
|
1071
1071
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
1072
1072
|
console.print(
|
|
1073
|
-
"[green]
|
|
1073
|
+
"[green][OK] Mock entity add-labels-by-attribute completed successfully[/green]"
|
|
1074
1074
|
)
|
|
1075
1075
|
return
|
|
1076
1076
|
|
|
@@ -1086,15 +1086,15 @@ def add_labels_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
1086
1086
|
result = entity_client.entityAddLabelsByUniqueAttribute(args)
|
|
1087
1087
|
|
|
1088
1088
|
if result:
|
|
1089
|
-
console.print("[green]
|
|
1089
|
+
console.print("[green][OK] Entity add-labels-by-attribute completed successfully[/green]")
|
|
1090
1090
|
console.print(json.dumps(result, indent=2))
|
|
1091
1091
|
else:
|
|
1092
1092
|
console.print(
|
|
1093
|
-
"[yellow]
|
|
1093
|
+
"[yellow][!] Entity add-labels-by-attribute completed with no result[/yellow]"
|
|
1094
1094
|
)
|
|
1095
1095
|
|
|
1096
1096
|
except Exception as e:
|
|
1097
|
-
console.print(f"[red]
|
|
1097
|
+
console.print(f"[red][X] Error executing entity add-labels-by-attribute: {str(e)}[/red]")
|
|
1098
1098
|
|
|
1099
1099
|
|
|
1100
1100
|
@entity.command()
|
|
@@ -1114,7 +1114,7 @@ def set_labels_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
1114
1114
|
console.print("[yellow]🎭 Mock: entity set-labels-by-attribute command[/yellow]")
|
|
1115
1115
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}[/dim]")
|
|
1116
1116
|
console.print(
|
|
1117
|
-
"[green]
|
|
1117
|
+
"[green][OK] Mock entity set-labels-by-attribute completed successfully[/green]"
|
|
1118
1118
|
)
|
|
1119
1119
|
return
|
|
1120
1120
|
|
|
@@ -1130,15 +1130,15 @@ def set_labels_by_attribute(ctx, type_name, qualified_name, payload_file):
|
|
|
1130
1130
|
result = entity_client.entitySetLabelsByUniqueAttribute(args)
|
|
1131
1131
|
|
|
1132
1132
|
if result:
|
|
1133
|
-
console.print("[green]
|
|
1133
|
+
console.print("[green][OK] Entity set-labels-by-attribute completed successfully[/green]")
|
|
1134
1134
|
console.print(json.dumps(result, indent=2))
|
|
1135
1135
|
else:
|
|
1136
1136
|
console.print(
|
|
1137
|
-
"[yellow]
|
|
1137
|
+
"[yellow][!] Entity set-labels-by-attribute completed with no result[/yellow]"
|
|
1138
1138
|
)
|
|
1139
1139
|
|
|
1140
1140
|
except Exception as e:
|
|
1141
|
-
console.print(f"[red]
|
|
1141
|
+
console.print(f"[red][X] Error executing entity set-labels-by-attribute: {str(e)}[/red]")
|
|
1142
1142
|
|
|
1143
1143
|
|
|
1144
1144
|
@entity.command()
|
|
@@ -1155,19 +1155,19 @@ def bulk_remove_labels(ctx, payload_file):
|
|
|
1155
1155
|
if ctx.obj.get("mock"):
|
|
1156
1156
|
console.print("[yellow]🎭 Mock: entity bulk-remove-labels command[/yellow]")
|
|
1157
1157
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
1158
|
-
console.print("[green]
|
|
1158
|
+
console.print("[green][OK] Mock entity bulk-remove-labels completed successfully[/green]")
|
|
1159
1159
|
return
|
|
1160
1160
|
args = {"--payloadFile": payload_file}
|
|
1161
1161
|
from purviewcli.client._entity import Entity
|
|
1162
1162
|
entity_client = Entity()
|
|
1163
1163
|
result = entity_client.entityBulkRemoveLabels(args)
|
|
1164
1164
|
if result:
|
|
1165
|
-
console.print("[green]
|
|
1165
|
+
console.print("[green][OK] Entity bulk-remove-labels completed successfully[/green]")
|
|
1166
1166
|
console.print(json.dumps(result, indent=2))
|
|
1167
1167
|
else:
|
|
1168
|
-
console.print("[yellow]
|
|
1168
|
+
console.print("[yellow][!] Entity bulk-remove-labels completed with no result[/yellow]")
|
|
1169
1169
|
except Exception as e:
|
|
1170
|
-
console.print(f"[red]
|
|
1170
|
+
console.print(f"[red][X] Error executing entity bulk-remove-labels: {str(e)}[/red]")
|
|
1171
1171
|
|
|
1172
1172
|
|
|
1173
1173
|
@entity.command()
|
|
@@ -1186,19 +1186,19 @@ def bulk_remove_labels_by_attribute(ctx, type_name, qualified_name, payload_file
|
|
|
1186
1186
|
if ctx.obj.get("mock"):
|
|
1187
1187
|
console.print("[yellow]🎭 Mock: entity bulk-remove-labels-by-attribute command[/yellow]")
|
|
1188
1188
|
console.print(f"[dim]Type: {type_name}, Qualified Name: {qualified_name}, Payload File: {payload_file}[/dim]")
|
|
1189
|
-
console.print("[green]
|
|
1189
|
+
console.print("[green][OK] Mock entity bulk-remove-labels-by-attribute completed successfully[/green]")
|
|
1190
1190
|
return
|
|
1191
1191
|
args = {"--typeName": type_name, "--qualifiedName": qualified_name, "--payloadFile": payload_file}
|
|
1192
1192
|
from purviewcli.client._entity import Entity
|
|
1193
1193
|
entity_client = Entity()
|
|
1194
1194
|
result = entity_client.entityBulkRemoveLabelsByUniqueAttribute(args)
|
|
1195
1195
|
if result:
|
|
1196
|
-
console.print("[green]
|
|
1196
|
+
console.print("[green][OK] Entity bulk-remove-labels-by-attribute completed successfully[/green]")
|
|
1197
1197
|
console.print(json.dumps(result, indent=2))
|
|
1198
1198
|
else:
|
|
1199
|
-
console.print("[yellow]
|
|
1199
|
+
console.print("[yellow][!] Entity bulk-remove-labels-by-attribute completed with no result[/yellow]")
|
|
1200
1200
|
except Exception as e:
|
|
1201
|
-
console.print(f"[red]
|
|
1201
|
+
console.print(f"[red][X] Error executing entity bulk-remove-labels-by-attribute: {str(e)}[/red]")
|
|
1202
1202
|
|
|
1203
1203
|
|
|
1204
1204
|
# === BUSINESS METADATA OPERATIONS ===
|
|
@@ -1223,7 +1223,7 @@ def add_business_metadata(ctx, guid, payload_file, is_overwrite):
|
|
|
1223
1223
|
console.print("[yellow]🎭 Mock: entity add-business-metadata command[/yellow]")
|
|
1224
1224
|
console.print(f"[dim]GUID: {guid}, Overwrite: {is_overwrite}[/dim]")
|
|
1225
1225
|
console.print(
|
|
1226
|
-
"[green]
|
|
1226
|
+
"[green][OK] Mock entity add-business-metadata completed successfully[/green]"
|
|
1227
1227
|
)
|
|
1228
1228
|
return
|
|
1229
1229
|
|
|
@@ -1239,15 +1239,15 @@ def add_business_metadata(ctx, guid, payload_file, is_overwrite):
|
|
|
1239
1239
|
result = entity_client.entityAddOrUpdateBusinessMetadata(args)
|
|
1240
1240
|
|
|
1241
1241
|
if result:
|
|
1242
|
-
console.print("[green]
|
|
1242
|
+
console.print("[green][OK] Entity add-business-metadata completed successfully[/green]")
|
|
1243
1243
|
console.print(json.dumps(result, indent=2))
|
|
1244
1244
|
else:
|
|
1245
1245
|
console.print(
|
|
1246
|
-
"[yellow]
|
|
1246
|
+
"[yellow][!] Entity add-business-metadata completed with no result[/yellow]"
|
|
1247
1247
|
)
|
|
1248
1248
|
|
|
1249
1249
|
except Exception as e:
|
|
1250
|
-
console.print(f"[red]
|
|
1250
|
+
console.print(f"[red][X] Error executing entity add-business-metadata: {str(e)}[/red]")
|
|
1251
1251
|
|
|
1252
1252
|
|
|
1253
1253
|
@entity.command()
|
|
@@ -1269,7 +1269,7 @@ def add_business_metadata_attributes(ctx, guid, bm_name, payload_file):
|
|
|
1269
1269
|
)
|
|
1270
1270
|
console.print(f"[dim]GUID: {guid}, BM Name: {bm_name}[/dim]")
|
|
1271
1271
|
console.print(
|
|
1272
|
-
"[green]
|
|
1272
|
+
"[green][OK] Mock entity add-business-metadata-attributes completed successfully[/green]"
|
|
1273
1273
|
)
|
|
1274
1274
|
return
|
|
1275
1275
|
|
|
@@ -1286,17 +1286,17 @@ def add_business_metadata_attributes(ctx, guid, bm_name, payload_file):
|
|
|
1286
1286
|
|
|
1287
1287
|
if result:
|
|
1288
1288
|
console.print(
|
|
1289
|
-
"[green]
|
|
1289
|
+
"[green][OK] Entity add-business-metadata-attributes completed successfully[/green]"
|
|
1290
1290
|
)
|
|
1291
1291
|
console.print(json.dumps(result, indent=2))
|
|
1292
1292
|
else:
|
|
1293
1293
|
console.print(
|
|
1294
|
-
"[yellow]
|
|
1294
|
+
"[yellow][!] Entity add-business-metadata-attributes completed with no result[/yellow]"
|
|
1295
1295
|
)
|
|
1296
1296
|
|
|
1297
1297
|
except Exception as e:
|
|
1298
1298
|
console.print(
|
|
1299
|
-
f"[red]
|
|
1299
|
+
f"[red][X] Error executing entity add-business-metadata-attributes: {str(e)}[/red]"
|
|
1300
1300
|
)
|
|
1301
1301
|
|
|
1302
1302
|
|
|
@@ -1316,7 +1316,7 @@ def remove_business_metadata(ctx, guid, payload_file):
|
|
|
1316
1316
|
console.print("[yellow]🎭 Mock: entity remove-business-metadata command[/yellow]")
|
|
1317
1317
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
1318
1318
|
console.print(
|
|
1319
|
-
"[green]
|
|
1319
|
+
"[green][OK] Mock entity remove-business-metadata completed successfully[/green]"
|
|
1320
1320
|
)
|
|
1321
1321
|
return
|
|
1322
1322
|
|
|
@@ -1331,15 +1331,15 @@ def remove_business_metadata(ctx, guid, payload_file):
|
|
|
1331
1331
|
result = entity_client.entityRemoveBusinessMetadata(args)
|
|
1332
1332
|
|
|
1333
1333
|
if result:
|
|
1334
|
-
console.print("[green]
|
|
1334
|
+
console.print("[green][OK] Entity remove-business-metadata completed successfully[/green]")
|
|
1335
1335
|
console.print(json.dumps(result, indent=2))
|
|
1336
1336
|
else:
|
|
1337
1337
|
console.print(
|
|
1338
|
-
"[yellow]
|
|
1338
|
+
"[yellow][!] Entity remove-business-metadata completed with no result[/yellow]"
|
|
1339
1339
|
)
|
|
1340
1340
|
|
|
1341
1341
|
except Exception as e:
|
|
1342
|
-
console.print(f"[red]
|
|
1342
|
+
console.print(f"[red][X] Error executing entity remove-business-metadata: {str(e)}[/red]")
|
|
1343
1343
|
|
|
1344
1344
|
|
|
1345
1345
|
@entity.command()
|
|
@@ -1361,7 +1361,7 @@ def remove_business_metadata_attributes(ctx, guid, bm_name, payload_file):
|
|
|
1361
1361
|
)
|
|
1362
1362
|
console.print(f"[dim]GUID: {guid}, BM Name: {bm_name}[/dim]")
|
|
1363
1363
|
console.print(
|
|
1364
|
-
"[green]
|
|
1364
|
+
"[green][OK] Mock entity remove-business-metadata-attributes completed successfully[/green]"
|
|
1365
1365
|
)
|
|
1366
1366
|
return
|
|
1367
1367
|
|
|
@@ -1378,17 +1378,17 @@ def remove_business_metadata_attributes(ctx, guid, bm_name, payload_file):
|
|
|
1378
1378
|
|
|
1379
1379
|
if result:
|
|
1380
1380
|
console.print(
|
|
1381
|
-
"[green]
|
|
1381
|
+
"[green][OK] Entity remove-business-metadata-attributes completed successfully[/green]"
|
|
1382
1382
|
)
|
|
1383
1383
|
console.print(json.dumps(result, indent=2))
|
|
1384
1384
|
else:
|
|
1385
1385
|
console.print(
|
|
1386
|
-
"[yellow]
|
|
1386
|
+
"[yellow][!] Entity remove-business-metadata-attributes completed with no result[/yellow]"
|
|
1387
1387
|
)
|
|
1388
1388
|
|
|
1389
1389
|
except Exception as e:
|
|
1390
1390
|
console.print(
|
|
1391
|
-
f"[red]
|
|
1391
|
+
f"[red][X] Error executing entity remove-business-metadata-attributes: {str(e)}[/red]"
|
|
1392
1392
|
)
|
|
1393
1393
|
|
|
1394
1394
|
|
|
@@ -1407,7 +1407,7 @@ def import_business_metadata(ctx, bm_file):
|
|
|
1407
1407
|
console.print("[yellow]🎭 Mock: entity import-business-metadata command[/yellow]")
|
|
1408
1408
|
console.print(f"[dim]BM File: {bm_file}[/dim]")
|
|
1409
1409
|
console.print(
|
|
1410
|
-
"[green]
|
|
1410
|
+
"[green][OK] Mock entity import-business-metadata completed successfully[/green]"
|
|
1411
1411
|
)
|
|
1412
1412
|
return
|
|
1413
1413
|
|
|
@@ -1419,15 +1419,15 @@ def import_business_metadata(ctx, bm_file):
|
|
|
1419
1419
|
result = entity_client.entityImportBusinessMetadata(args)
|
|
1420
1420
|
|
|
1421
1421
|
if result:
|
|
1422
|
-
console.print("[green]
|
|
1422
|
+
console.print("[green][OK] Entity import-business-metadata completed successfully[/green]")
|
|
1423
1423
|
console.print(json.dumps(result, indent=2))
|
|
1424
1424
|
else:
|
|
1425
1425
|
console.print(
|
|
1426
|
-
"[yellow]
|
|
1426
|
+
"[yellow][!] Entity import-business-metadata completed with no result[/yellow]"
|
|
1427
1427
|
)
|
|
1428
1428
|
|
|
1429
1429
|
except Exception as e:
|
|
1430
|
-
console.print(f"[red]
|
|
1430
|
+
console.print(f"[red][X] Error executing entity import-business-metadata: {str(e)}[/red]")
|
|
1431
1431
|
|
|
1432
1432
|
|
|
1433
1433
|
@entity.command()
|
|
@@ -1438,7 +1438,7 @@ def get_business_metadata_template(ctx):
|
|
|
1438
1438
|
if ctx.obj.get("mock"):
|
|
1439
1439
|
console.print("[yellow]🎭 Mock: entity get-business-metadata-template command[/yellow]")
|
|
1440
1440
|
console.print(
|
|
1441
|
-
"[green]
|
|
1441
|
+
"[green][OK] Mock entity get-business-metadata-template completed successfully[/green]"
|
|
1442
1442
|
)
|
|
1443
1443
|
return
|
|
1444
1444
|
|
|
@@ -1451,17 +1451,17 @@ def get_business_metadata_template(ctx):
|
|
|
1451
1451
|
|
|
1452
1452
|
if result:
|
|
1453
1453
|
console.print(
|
|
1454
|
-
"[green]
|
|
1454
|
+
"[green][OK] Entity get-business-metadata-template completed successfully[/green]"
|
|
1455
1455
|
)
|
|
1456
1456
|
console.print(json.dumps(result, indent=2))
|
|
1457
1457
|
else:
|
|
1458
1458
|
console.print(
|
|
1459
|
-
"[yellow]
|
|
1459
|
+
"[yellow][!] Entity get-business-metadata-template completed with no result[/yellow]"
|
|
1460
1460
|
)
|
|
1461
1461
|
|
|
1462
1462
|
except Exception as e:
|
|
1463
1463
|
console.print(
|
|
1464
|
-
f"[red]
|
|
1464
|
+
f"[red][X] Error executing entity get-business-metadata-template: {str(e)}[/red]"
|
|
1465
1465
|
)
|
|
1466
1466
|
|
|
1467
1467
|
|
|
@@ -1482,7 +1482,7 @@ def move_to_collection(ctx, payload_file):
|
|
|
1482
1482
|
if ctx.obj.get("mock"):
|
|
1483
1483
|
console.print("[yellow]🎭 Mock: entity move-to-collection command[/yellow]")
|
|
1484
1484
|
console.print(f"[dim]Payload File: {payload_file}[/dim]")
|
|
1485
|
-
console.print("[green]
|
|
1485
|
+
console.print("[green][OK] Mock entity move-to-collection completed successfully[/green]")
|
|
1486
1486
|
return
|
|
1487
1487
|
|
|
1488
1488
|
args = {"--payloadFile": payload_file}
|
|
@@ -1493,13 +1493,13 @@ def move_to_collection(ctx, payload_file):
|
|
|
1493
1493
|
result = entity_client.entityMoveEntitiesToCollection(args)
|
|
1494
1494
|
|
|
1495
1495
|
if result:
|
|
1496
|
-
console.print("[green]
|
|
1496
|
+
console.print("[green][OK] Entity move-to-collection completed successfully[/green]")
|
|
1497
1497
|
console.print(json.dumps(result, indent=2))
|
|
1498
1498
|
else:
|
|
1499
|
-
console.print("[yellow]
|
|
1499
|
+
console.print("[yellow][!] Entity move-to-collection completed with no result[/yellow]")
|
|
1500
1500
|
|
|
1501
1501
|
except Exception as e:
|
|
1502
|
-
console.print(f"[red]
|
|
1502
|
+
console.print(f"[red][X] Error executing entity move-to-collection: {str(e)}[/red]")
|
|
1503
1503
|
|
|
1504
1504
|
|
|
1505
1505
|
# === SAMPLE OPERATIONS ===
|
|
@@ -1514,7 +1514,7 @@ def read_sample(ctx, guid):
|
|
|
1514
1514
|
if ctx.obj.get("mock"):
|
|
1515
1515
|
console.print("[yellow]🎭 Mock: entity read-sample command[/yellow]")
|
|
1516
1516
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
1517
|
-
console.print("[green]
|
|
1517
|
+
console.print("[green][OK] Mock entity read-sample completed successfully[/green]")
|
|
1518
1518
|
return
|
|
1519
1519
|
|
|
1520
1520
|
args = {"--guid": [guid]}
|
|
@@ -1525,13 +1525,13 @@ def read_sample(ctx, guid):
|
|
|
1525
1525
|
result = entity_client.entityReadSample(args)
|
|
1526
1526
|
|
|
1527
1527
|
if result:
|
|
1528
|
-
console.print("[green]
|
|
1528
|
+
console.print("[green][OK] Entity read-sample completed successfully[/green]")
|
|
1529
1529
|
console.print(json.dumps(result, indent=2))
|
|
1530
1530
|
else:
|
|
1531
|
-
console.print("[yellow]
|
|
1531
|
+
console.print("[yellow][!] Entity read-sample completed with no result[/yellow]")
|
|
1532
1532
|
|
|
1533
1533
|
except Exception as e:
|
|
1534
|
-
console.print(f"[red]
|
|
1534
|
+
console.print(f"[red][X] Error executing entity read-sample: {str(e)}[/red]")
|
|
1535
1535
|
|
|
1536
1536
|
|
|
1537
1537
|
@entity.command()
|
|
@@ -1547,12 +1547,12 @@ def bulk_classify_csv(ctx, csv_file, batch_size):
|
|
|
1547
1547
|
if ctx.obj.get("mock"):
|
|
1548
1548
|
console.print("[yellow]🎭 Mock: entity bulk-classify-csv command[/yellow]")
|
|
1549
1549
|
console.print(f"[dim]CSV File: {csv_file}[/dim]")
|
|
1550
|
-
console.print("[green]
|
|
1550
|
+
console.print("[green][OK] Mock entity bulk-classify-csv completed successfully[/green]")
|
|
1551
1551
|
return
|
|
1552
1552
|
|
|
1553
1553
|
df = pd.read_csv(csv_file)
|
|
1554
1554
|
if "guid" not in df.columns or "classificationName" not in df.columns:
|
|
1555
|
-
console.print("[red]
|
|
1555
|
+
console.print("[red][X] CSV must contain 'guid' and 'classificationName' columns[/red]")
|
|
1556
1556
|
return
|
|
1557
1557
|
entity_client = Entity()
|
|
1558
1558
|
total = len(df)
|
|
@@ -1588,13 +1588,13 @@ def bulk_classify_csv(ctx, csv_file, batch_size):
|
|
|
1588
1588
|
finally:
|
|
1589
1589
|
import os
|
|
1590
1590
|
os.remove(payload_file)
|
|
1591
|
-
console.print(f"[green]
|
|
1591
|
+
console.print(f"[green][OK] Bulk classification completed. Success: {success}, Failed: {failed}[/green]")
|
|
1592
1592
|
if errors:
|
|
1593
1593
|
console.print("[red]Errors:[/red]")
|
|
1594
1594
|
for err in errors:
|
|
1595
1595
|
console.print(f"[red]- {err}[/red]")
|
|
1596
1596
|
except Exception as e:
|
|
1597
|
-
console.print(f"[red]
|
|
1597
|
+
console.print(f"[red][X] Error executing entity bulk-classify-csv: {str(e)}[/red]")
|
|
1598
1598
|
|
|
1599
1599
|
|
|
1600
1600
|
# === BULK ENTITY CSV OPERATIONS ===
|
|
@@ -1615,12 +1615,12 @@ def bulk_create_csv(ctx, csv_file, batch_size, dry_run, error_csv):
|
|
|
1615
1615
|
if ctx.obj.get("mock"):
|
|
1616
1616
|
console.print("[yellow]🎭 Mock: entity bulk-create-csv command[/yellow]")
|
|
1617
1617
|
console.print(f"[dim]CSV File: {csv_file}[/dim]")
|
|
1618
|
-
console.print("[green]
|
|
1618
|
+
console.print("[green][OK] Mock entity bulk-create-csv completed successfully[/green]")
|
|
1619
1619
|
return
|
|
1620
1620
|
|
|
1621
1621
|
df = pd.read_csv(csv_file)
|
|
1622
1622
|
if "typeName" not in df.columns or "qualifiedName" not in df.columns:
|
|
1623
|
-
console.print("[red]
|
|
1623
|
+
console.print("[red][X] CSV must contain at least 'typeName' and 'qualifiedName' columns[/red]")
|
|
1624
1624
|
return
|
|
1625
1625
|
entity_client = Entity()
|
|
1626
1626
|
total = len(df)
|
|
@@ -1685,58 +1685,164 @@ def bulk_update_csv(ctx, csv_file, batch_size, dry_run, error_csv):
|
|
|
1685
1685
|
if ctx.obj.get("mock"):
|
|
1686
1686
|
console.print("[yellow]🎭 Mock: entity bulk-update-csv command[/yellow]")
|
|
1687
1687
|
console.print(f"[dim]CSV File: {csv_file}[/dim]")
|
|
1688
|
-
console.print("[green]
|
|
1688
|
+
console.print("[green][OK] Mock entity bulk-update-csv completed successfully[/green]")
|
|
1689
1689
|
return
|
|
1690
1690
|
|
|
1691
1691
|
df = pd.read_csv(csv_file)
|
|
1692
|
-
if
|
|
1693
|
-
console.print("[
|
|
1692
|
+
if df.empty:
|
|
1693
|
+
console.print("[yellow]No rows found in CSV. Exiting.[/yellow]")
|
|
1694
1694
|
return
|
|
1695
|
+
|
|
1695
1696
|
entity_client = Entity()
|
|
1696
1697
|
total = len(df)
|
|
1697
1698
|
success, failed = 0, 0
|
|
1698
1699
|
errors = []
|
|
1699
1700
|
failed_rows = []
|
|
1701
|
+
|
|
1702
|
+
# Determine mode:
|
|
1703
|
+
# - If CSV has both 'typeName' and 'qualifiedName' -> map rows to Purview entities and call bulk create-or-update
|
|
1704
|
+
# - Else if CSV has 'guid' -> build guid-based payloads (preferred for partial attribute updates)
|
|
1705
|
+
has_type_qn = ("typeName" in df.columns and "qualifiedName" in df.columns)
|
|
1706
|
+
has_guid = "guid" in df.columns
|
|
1707
|
+
|
|
1700
1708
|
for i in range(0, total, batch_size):
|
|
1701
|
-
batch = df.iloc[i:i+batch_size]
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1709
|
+
batch = df.iloc[i : i + batch_size]
|
|
1710
|
+
|
|
1711
|
+
if has_type_qn:
|
|
1712
|
+
# Map flat rows to Purview entity objects using helper
|
|
1713
|
+
from purviewcli.client._entity import map_flat_entity_to_purview_entity
|
|
1714
|
+
|
|
1715
|
+
entities = [map_flat_entity_to_purview_entity(row) for _, row in batch.iterrows()]
|
|
1716
|
+
payload = {"entities": entities}
|
|
1717
|
+
|
|
1718
|
+
if dry_run:
|
|
1719
|
+
console.print(f"[blue]DRY RUN: Would bulk-create/update batch {i//batch_size+1} with {len(batch)} entities[/blue]")
|
|
1720
|
+
continue
|
|
1721
|
+
|
|
1722
|
+
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False, encoding="utf-8") as tmpf:
|
|
1723
|
+
json.dump(payload, tmpf, indent=2)
|
|
1724
|
+
tmpf.flush()
|
|
1725
|
+
payload_file = tmpf.name
|
|
1726
|
+
|
|
1727
|
+
try:
|
|
1728
|
+
args = {"--payloadFile": payload_file}
|
|
1729
|
+
result = entity_client.entityCreateBulk(args)
|
|
1730
|
+
if result and (not isinstance(result, dict) or result.get("status") != "error"):
|
|
1731
|
+
success += len(batch)
|
|
1732
|
+
else:
|
|
1733
|
+
failed += len(batch)
|
|
1734
|
+
errors.append(f"Batch {i//batch_size+1}: {result}")
|
|
1735
|
+
failed_rows.extend(batch.to_dict(orient="records"))
|
|
1736
|
+
except Exception as e:
|
|
1721
1737
|
failed += len(batch)
|
|
1722
|
-
errors.append(f"Batch {i//batch_size+1}: {
|
|
1738
|
+
errors.append(f"Batch {i//batch_size+1}: {str(e)}")
|
|
1723
1739
|
failed_rows.extend(batch.to_dict(orient="records"))
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1740
|
+
finally:
|
|
1741
|
+
try:
|
|
1742
|
+
os.remove(payload_file)
|
|
1743
|
+
except Exception:
|
|
1744
|
+
pass
|
|
1745
|
+
|
|
1746
|
+
elif has_guid:
|
|
1747
|
+
# Build guid-based updates. If the CSV contains only guid + attr columns, we'll attempt to perform
|
|
1748
|
+
# partial attribute updates by calling entityPartialUpdateAttribute where possible.
|
|
1749
|
+
# If a row contains multiple attributes, we will call entityCreateBulk with a payload containing
|
|
1750
|
+
# the guid and attributes (server supports bulk create-or-update by guid in some endpoints).
|
|
1751
|
+
|
|
1752
|
+
# Normalize rows into dicts
|
|
1753
|
+
rows = [row.to_dict() for _, row in batch.iterrows()]
|
|
1754
|
+
|
|
1755
|
+
# Attempt to detect single-attribute update pattern: columns [guid, attrName, attrValue]
|
|
1756
|
+
if set(["guid", "attrName", "attrValue"]).issubset(set(batch.columns)):
|
|
1757
|
+
# perform per-guid partial updates in batch
|
|
1758
|
+
for r in rows:
|
|
1759
|
+
guid = str(r.get("guid"))
|
|
1760
|
+
attr_name = r.get("attrName")
|
|
1761
|
+
attr_value = r.get("attrValue")
|
|
1762
|
+
if pd.isna(guid) or pd.isna(attr_name):
|
|
1763
|
+
failed += 1
|
|
1764
|
+
failed_rows.append(r)
|
|
1765
|
+
continue
|
|
1766
|
+
if dry_run:
|
|
1767
|
+
console.print(f"[blue]DRY RUN: Would update GUID {guid} set {attr_name}={attr_value}[/blue]")
|
|
1768
|
+
success += 1
|
|
1769
|
+
continue
|
|
1770
|
+
try:
|
|
1771
|
+
args = {"--guid": [guid], "--attrName": attr_name, "--attrValue": attr_value}
|
|
1772
|
+
result = entity_client.entityPartialUpdateAttribute(args)
|
|
1773
|
+
if result and (not isinstance(result, dict) or result.get("status") != "error"):
|
|
1774
|
+
success += 1
|
|
1775
|
+
else:
|
|
1776
|
+
failed += 1
|
|
1777
|
+
errors.append(f"GUID {guid}: {result}")
|
|
1778
|
+
failed_rows.append(r)
|
|
1779
|
+
except Exception as e:
|
|
1780
|
+
failed += 1
|
|
1781
|
+
errors.append(f"GUID {guid}: {str(e)}")
|
|
1782
|
+
failed_rows.append(r)
|
|
1783
|
+
|
|
1784
|
+
else:
|
|
1785
|
+
# Fallback: call bulk create-or-update with guid included in each entity object.
|
|
1786
|
+
# Map each row into an entity dict keeping non-null columns.
|
|
1787
|
+
entities = []
|
|
1788
|
+
for r in rows:
|
|
1789
|
+
if pd.isna(r.get("guid")):
|
|
1790
|
+
failed_rows.append(r)
|
|
1791
|
+
failed += 1
|
|
1792
|
+
continue
|
|
1793
|
+
ent = {k: v for k, v in r.items() if pd.notnull(v)}
|
|
1794
|
+
# ensure guid is string under top-level 'guid' field for server bulk endpoints
|
|
1795
|
+
ent["guid"] = str(ent.get("guid"))
|
|
1796
|
+
entities.append(ent)
|
|
1797
|
+
|
|
1798
|
+
if not entities:
|
|
1799
|
+
continue
|
|
1800
|
+
|
|
1801
|
+
payload = {"entities": entities}
|
|
1802
|
+
if dry_run:
|
|
1803
|
+
console.print(f"[blue]DRY RUN: Would bulk-update (by guid) batch {i//batch_size+1} with {len(entities)} entities[/blue]")
|
|
1804
|
+
success += len(entities)
|
|
1805
|
+
continue
|
|
1806
|
+
|
|
1807
|
+
with tempfile.NamedTemporaryFile(mode="w", suffix=".json", delete=False, encoding="utf-8") as tmpf:
|
|
1808
|
+
json.dump(payload, tmpf, indent=2)
|
|
1809
|
+
tmpf.flush()
|
|
1810
|
+
payload_file = tmpf.name
|
|
1811
|
+
|
|
1812
|
+
try:
|
|
1813
|
+
args = {"--payloadFile": payload_file}
|
|
1814
|
+
# Use the create-or-update bulk endpoint - server will use guid when present
|
|
1815
|
+
result = entity_client.entityCreateBulk(args)
|
|
1816
|
+
if result and (not isinstance(result, dict) or result.get("status") != "error"):
|
|
1817
|
+
success += len(entities)
|
|
1818
|
+
else:
|
|
1819
|
+
failed += len(entities)
|
|
1820
|
+
errors.append(f"Batch {i//batch_size+1}: {result}")
|
|
1821
|
+
failed_rows.extend(batch.to_dict(orient="records"))
|
|
1822
|
+
except Exception as e:
|
|
1823
|
+
failed += len(entities)
|
|
1824
|
+
errors.append(f"Batch {i//batch_size+1}: {str(e)}")
|
|
1825
|
+
failed_rows.extend(batch.to_dict(orient="records"))
|
|
1826
|
+
finally:
|
|
1827
|
+
try:
|
|
1828
|
+
os.remove(payload_file)
|
|
1829
|
+
except Exception:
|
|
1830
|
+
pass
|
|
1831
|
+
|
|
1832
|
+
else:
|
|
1833
|
+
console.print(f"[red][X] CSV must contain either (typeName and qualifiedName) or guid column[/red]")
|
|
1834
|
+
return
|
|
1835
|
+
|
|
1836
|
+
console.print(f"[green][OK] Bulk update completed. Success: {success}, Failed: {failed}[/green]")
|
|
1731
1837
|
if errors:
|
|
1732
1838
|
console.print("[red]Errors:[/red]")
|
|
1733
1839
|
for err in errors:
|
|
1734
1840
|
console.print(f"[red]- {err}[/red]")
|
|
1735
1841
|
if error_csv and failed_rows:
|
|
1736
1842
|
pd.DataFrame(failed_rows).to_csv(error_csv, index=False)
|
|
1737
|
-
console.print(f"[yellow]
|
|
1843
|
+
console.print(f"[yellow]WARNING: Failed rows written to {error_csv}[/yellow]")
|
|
1738
1844
|
except Exception as e:
|
|
1739
|
-
console.print(f"[red]
|
|
1845
|
+
console.print(f"[red][X] Error executing entity bulk-update-csv: {str(e)}[/red]")
|
|
1740
1846
|
|
|
1741
1847
|
|
|
1742
1848
|
@entity.command()
|
|
@@ -1754,12 +1860,12 @@ def bulk_delete_csv(ctx, csv_file, batch_size, dry_run, error_csv):
|
|
|
1754
1860
|
if ctx.obj.get("mock"):
|
|
1755
1861
|
console.print("[yellow]🎭 Mock: entity bulk-delete-csv command[/yellow]")
|
|
1756
1862
|
console.print(f"[dim]CSV File: {csv_file}[/dim]")
|
|
1757
|
-
console.print("[green]
|
|
1863
|
+
console.print("[green][OK] Mock entity bulk-delete-csv completed successfully[/green]")
|
|
1758
1864
|
return
|
|
1759
1865
|
|
|
1760
1866
|
df = pd.read_csv(csv_file)
|
|
1761
1867
|
if "guid" not in df.columns:
|
|
1762
|
-
console.print("[red]
|
|
1868
|
+
console.print("[red][X] CSV must contain 'guid' column[/red]")
|
|
1763
1869
|
return
|
|
1764
1870
|
entity_client = Entity()
|
|
1765
1871
|
total = len(df)
|
|
@@ -1774,7 +1880,7 @@ def bulk_delete_csv(ctx, csv_file, batch_size, dry_run, error_csv):
|
|
|
1774
1880
|
continue
|
|
1775
1881
|
try:
|
|
1776
1882
|
args = {"--guid": guids}
|
|
1777
|
-
result = entity_client.
|
|
1883
|
+
result = entity_client.entityDeleteBulk(args)
|
|
1778
1884
|
if result and (not isinstance(result, dict) or result.get("status") != "error"):
|
|
1779
1885
|
success += len(guids)
|
|
1780
1886
|
else:
|
|
@@ -1785,16 +1891,16 @@ def bulk_delete_csv(ctx, csv_file, batch_size, dry_run, error_csv):
|
|
|
1785
1891
|
failed += len(guids)
|
|
1786
1892
|
errors.append(f"Batch {i//batch_size+1}: {str(e)}")
|
|
1787
1893
|
failed_rows.extend(batch.to_dict(orient="records"))
|
|
1788
|
-
console.print(f"[green]
|
|
1894
|
+
console.print(f"[green][OK] Bulk delete completed. Success: {success}, Failed: {failed}[/green]")
|
|
1789
1895
|
if errors:
|
|
1790
1896
|
console.print("[red]Errors:[/red]")
|
|
1791
1897
|
for err in errors:
|
|
1792
1898
|
console.print(f"[red]- {err}[/red]")
|
|
1793
1899
|
if error_csv and failed_rows:
|
|
1794
1900
|
pd.DataFrame(failed_rows).to_csv(error_csv, index=False)
|
|
1795
|
-
console.print(f"[yellow]
|
|
1901
|
+
console.print(f"[yellow][X] Failed rows written to {error_csv}[/yellow]")
|
|
1796
1902
|
except Exception as e:
|
|
1797
|
-
console.print(f"[red]
|
|
1903
|
+
console.print(f"[red][X] Error executing entity bulk-delete-csv: {str(e)}[/red]")
|
|
1798
1904
|
|
|
1799
1905
|
|
|
1800
1906
|
# === AUDIT OPERATIONS ===
|
|
@@ -1809,19 +1915,19 @@ def audit(ctx, guid):
|
|
|
1809
1915
|
if ctx.obj.get("mock"):
|
|
1810
1916
|
console.print("[yellow]🎭 Mock: entity audit command[/yellow]")
|
|
1811
1917
|
console.print(f"[dim]GUID: {guid}[/dim]")
|
|
1812
|
-
console.print("[green]
|
|
1918
|
+
console.print("[green][OK] Mock entity audit completed successfully[/green]")
|
|
1813
1919
|
return
|
|
1814
1920
|
args = {"--guid": guid}
|
|
1815
1921
|
from purviewcli.client._entity import Entity
|
|
1816
1922
|
entity_client = Entity()
|
|
1817
1923
|
result = entity_client.entityReadAudit(args)
|
|
1818
1924
|
if result:
|
|
1819
|
-
console.print("[green]
|
|
1925
|
+
console.print("[green][OK] Entity audit events retrieved successfully[/green]")
|
|
1820
1926
|
console.print(json.dumps(result, indent=2))
|
|
1821
1927
|
else:
|
|
1822
|
-
console.print("[yellow]
|
|
1928
|
+
console.print("[yellow][!] Entity audit completed with no result[/yellow]")
|
|
1823
1929
|
except Exception as e:
|
|
1824
|
-
console.print(f"[red]
|
|
1930
|
+
console.print(f"[red][X] Error executing entity audit: {str(e)}[/red]")
|
|
1825
1931
|
|
|
1826
1932
|
|
|
1827
1933
|
@entity.command()
|
|
@@ -1859,7 +1965,7 @@ def list(type_name, limit):
|
|
|
1859
1965
|
except Exception as e:
|
|
1860
1966
|
from rich.console import Console
|
|
1861
1967
|
console = Console()
|
|
1862
|
-
console.print(f"[red]
|
|
1968
|
+
console.print(f"[red][X] Error executing entity list: {str(e)}[/red]")
|
|
1863
1969
|
|
|
1864
1970
|
|
|
1865
1971
|
@entity.command("bulk-delete-optimized")
|
|
@@ -1904,8 +2010,8 @@ def bulk_delete_optimized(ctx, guids, bulk_size, max_parallel, throttle_ms,
|
|
|
1904
2010
|
api_calls_per_job = math.ceil(assets_per_job / bulk_size)
|
|
1905
2011
|
total_api_calls = api_calls_per_job * max_parallel
|
|
1906
2012
|
|
|
1907
|
-
console.print(f"[blue]
|
|
1908
|
-
console.print(f"
|
|
2013
|
+
console.print(f"[blue][*] Mathematical Optimization Analysis:[/blue]")
|
|
2014
|
+
console.print(f" [INFO] Total Assets: {total_assets}")
|
|
1909
2015
|
console.print(f" 🔄 Parallel Jobs: {max_parallel}")
|
|
1910
2016
|
console.print(f" 📦 Assets per Job: {assets_per_job}")
|
|
1911
2017
|
console.print(f" 🚀 Bulk Size: {bulk_size}")
|
|
@@ -1917,7 +2023,7 @@ def bulk_delete_optimized(ctx, guids, bulk_size, max_parallel, throttle_ms,
|
|
|
1917
2023
|
console.print(f"[green]✨ Perfect mathematical division achieved! Zero waste.[/green]")
|
|
1918
2024
|
else:
|
|
1919
2025
|
waste_assets = (total_api_calls * bulk_size) - total_assets
|
|
1920
|
-
console.print(f"[yellow]
|
|
2026
|
+
console.print(f"[yellow][!] Mathematical waste: {waste_assets} empty slots in final requests[/yellow]")
|
|
1921
2027
|
|
|
1922
2028
|
if continuous and collection_name:
|
|
1923
2029
|
deleted_count = _continuous_collection_deletion(
|
|
@@ -1930,12 +2036,12 @@ def bulk_delete_optimized(ctx, guids, bulk_size, max_parallel, throttle_ms,
|
|
|
1930
2036
|
throttle_ms, batch_throttle_ms, dry_run
|
|
1931
2037
|
)
|
|
1932
2038
|
|
|
1933
|
-
console.print(f"[green]
|
|
2039
|
+
console.print(f"[green][OK] {'Would delete' if dry_run else 'Successfully deleted'} {deleted_count} assets[/green]")
|
|
1934
2040
|
|
|
1935
2041
|
except Exception as e:
|
|
1936
2042
|
from rich.console import Console
|
|
1937
2043
|
console = Console()
|
|
1938
|
-
console.print(f"[red]
|
|
2044
|
+
console.print(f"[red][X] Error in bulk-delete-optimized: {str(e)}[/red]")
|
|
1939
2045
|
|
|
1940
2046
|
|
|
1941
2047
|
@entity.command("bulk-delete-from-collection")
|
|
@@ -1973,12 +2079,12 @@ def bulk_delete_from_collection(ctx, collection_name, bulk_size, max_parallel,
|
|
|
1973
2079
|
throttle_ms, 800, dry_run, batch_size
|
|
1974
2080
|
)
|
|
1975
2081
|
|
|
1976
|
-
console.print(f"[green]
|
|
2082
|
+
console.print(f"[green][OK] Collection cleanup complete: {'Would delete' if dry_run else 'Deleted'} {deleted_count} total assets[/green]")
|
|
1977
2083
|
|
|
1978
2084
|
except Exception as e:
|
|
1979
2085
|
from rich.console import Console
|
|
1980
2086
|
console = Console()
|
|
1981
|
-
console.print(f"[red]
|
|
2087
|
+
console.print(f"[red][X] Error in bulk-delete-from-collection: {str(e)}[/red]")
|
|
1982
2088
|
|
|
1983
2089
|
|
|
1984
2090
|
@entity.command("count-assets")
|
|
@@ -1996,12 +2102,12 @@ def count_assets(ctx, collection_name, by_type, include_relationships):
|
|
|
1996
2102
|
from rich.table import Table
|
|
1997
2103
|
|
|
1998
2104
|
console = Console()
|
|
1999
|
-
console.print(f"[blue]
|
|
2105
|
+
console.print(f"[blue][INFO] Counting assets in collection: {collection_name}[/blue]")
|
|
2000
2106
|
|
|
2001
2107
|
# Get asset count using search API
|
|
2002
2108
|
total_count = _get_collection_asset_count(collection_name)
|
|
2003
2109
|
|
|
2004
|
-
console.print(f"[green]
|
|
2110
|
+
console.print(f"[green][OK] Total assets: {total_count}[/green]")
|
|
2005
2111
|
|
|
2006
2112
|
if by_type:
|
|
2007
2113
|
type_counts = _get_asset_type_breakdown(collection_name)
|
|
@@ -2014,7 +2120,7 @@ def count_assets(ctx, collection_name, by_type, include_relationships):
|
|
|
2014
2120
|
except Exception as e:
|
|
2015
2121
|
from rich.console import Console
|
|
2016
2122
|
console = Console()
|
|
2017
|
-
console.print(f"[red]
|
|
2123
|
+
console.print(f"[red][X] Error in count-assets: {str(e)}[/red]")
|
|
2018
2124
|
|
|
2019
2125
|
|
|
2020
2126
|
@entity.command("analyze-performance")
|
|
@@ -2073,7 +2179,7 @@ def analyze_performance(ctx, bulk_size, max_parallel, asset_count):
|
|
|
2073
2179
|
console.print("\n[blue]💡 Optimization Recommendations:[/blue]")
|
|
2074
2180
|
|
|
2075
2181
|
if asset_count % (max_parallel * bulk_size) == 0:
|
|
2076
|
-
console.print("[green]
|
|
2182
|
+
console.print("[green][OK] Perfect mathematical division - optimal configuration![/green]")
|
|
2077
2183
|
else:
|
|
2078
2184
|
# Calculate optimal configurations
|
|
2079
2185
|
optimal_configs = _calculate_optimal_configs(asset_count, bulk_size)
|
|
@@ -2084,7 +2190,7 @@ def analyze_performance(ctx, bulk_size, max_parallel, asset_count):
|
|
|
2084
2190
|
except Exception as e:
|
|
2085
2191
|
from rich.console import Console
|
|
2086
2192
|
console = Console()
|
|
2087
|
-
console.print(f"[red]
|
|
2193
|
+
console.print(f"[red][X] Error in analyze-performance: {str(e)}[/red]")
|
|
2088
2194
|
|
|
2089
2195
|
|
|
2090
2196
|
# === ENHANCED BULK OPERATION FUNCTIONS ===
|
|
@@ -2109,7 +2215,7 @@ def _execute_optimized_bulk_delete(ctx, guids, bulk_size, max_parallel, throttle
|
|
|
2109
2215
|
deleted_count = 0
|
|
2110
2216
|
|
|
2111
2217
|
if dry_run:
|
|
2112
|
-
console.print(f"[yellow]
|
|
2218
|
+
console.print(f"[yellow][*] DRY RUN: Would delete {total_assets} assets[/yellow]")
|
|
2113
2219
|
return total_assets
|
|
2114
2220
|
|
|
2115
2221
|
from purviewcli.client._entity import Entity
|
|
@@ -2156,7 +2262,7 @@ def _execute_optimized_bulk_delete(ctx, guids, bulk_size, max_parallel, throttle
|
|
|
2156
2262
|
time.sleep(batch_throttle_ms / 1000)
|
|
2157
2263
|
|
|
2158
2264
|
except Exception as e:
|
|
2159
|
-
console.print(f"[red]
|
|
2265
|
+
console.print(f"[red][X] Batch deletion failed: {str(e)}[/red]")
|
|
2160
2266
|
|
|
2161
2267
|
return deleted_count
|
|
2162
2268
|
|
|
@@ -2188,7 +2294,7 @@ def _delete_batch_job(entity_client, guid_batch, bulk_size, throttle_ms, job_id)
|
|
|
2188
2294
|
except Exception as e:
|
|
2189
2295
|
from rich.console import Console
|
|
2190
2296
|
console = Console()
|
|
2191
|
-
console.print(f"[red]
|
|
2297
|
+
console.print(f"[red][X] Job {job_id} bulk delete failed: {str(e)}[/red]")
|
|
2192
2298
|
|
|
2193
2299
|
return deleted_in_job
|
|
2194
2300
|
|
|
@@ -2212,14 +2318,14 @@ def _continuous_collection_deletion(ctx, collection_name, bulk_size, max_paralle
|
|
|
2212
2318
|
asset_guids = _get_collection_assets_batch(collection_name, batch_size)
|
|
2213
2319
|
|
|
2214
2320
|
if not asset_guids:
|
|
2215
|
-
console.print("[green]
|
|
2321
|
+
console.print("[green][OK] No more assets found - collection is clean![/green]")
|
|
2216
2322
|
break
|
|
2217
2323
|
|
|
2218
2324
|
found_count = len(asset_guids)
|
|
2219
|
-
console.print(f"[blue]
|
|
2325
|
+
console.print(f"[blue][INFO] Found {found_count} assets in iteration {iteration}[/blue]")
|
|
2220
2326
|
|
|
2221
2327
|
if dry_run:
|
|
2222
|
-
console.print(f"[yellow]
|
|
2328
|
+
console.print(f"[yellow][*] DRY RUN: Would delete {found_count} assets[/yellow]")
|
|
2223
2329
|
total_deleted += found_count
|
|
2224
2330
|
else:
|
|
2225
2331
|
# Execute optimized deletion for this batch
|
|
@@ -2229,14 +2335,14 @@ def _continuous_collection_deletion(ctx, collection_name, bulk_size, max_paralle
|
|
|
2229
2335
|
)
|
|
2230
2336
|
|
|
2231
2337
|
total_deleted += deleted_in_iteration
|
|
2232
|
-
console.print(f"[green]
|
|
2338
|
+
console.print(f"[green][OK] Iteration {iteration}: Deleted {deleted_in_iteration}/{found_count} assets[/green]")
|
|
2233
2339
|
console.print(f"[blue]📈 Running total: {total_deleted} assets deleted[/blue]")
|
|
2234
2340
|
|
|
2235
2341
|
iteration += 1
|
|
2236
2342
|
|
|
2237
2343
|
# Break after reasonable number of iterations in dry-run
|
|
2238
2344
|
if dry_run and iteration > 5:
|
|
2239
|
-
console.print("[yellow]
|
|
2345
|
+
console.print("[yellow][*] DRY RUN: Simulated 5 iterations[/yellow]")
|
|
2240
2346
|
break
|
|
2241
2347
|
|
|
2242
2348
|
return total_deleted
|