Extract Collections
Overview
Extract and outputs the collection hierarchy structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_collection_name |
str
|
Collection to start on. |
required |
safe_delete_name |
str
|
The client name to be used when printing the safe delete commands. Default is 'client'. |
'client'
|
api_version |
Optional[str]
|
API version to use. If None, default is "2019-11-01-preview". |
None
|
Returns:
Type | Description |
---|---|
None
|
None. Will print out the script to create the collection hierarchy structure |
None
|
starting at the start_collection_name. |
Source code in purviewautomation/collections.py
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 |
|
Examples
If the Purview collections look like this:
To extract the exact script to create the hierarchy starting from collection1
:
client.extract_collections(start_collection_name="collection1")
Will output (print) to the screen the script to recreate the hierarchy:
Important
The start_collection parameter value may show random strings as the name. This is because the code will grab the original actual name to recreate the hierarchy exactly as it was (same actual and friendly names). For more info on what actual names and friendly names mean, see: Purview Names Overview.
The script can be saved for later use or to deploy to other Purview (UAT/PROD) environments.
For example, another Purview that's used as a UAT Purview:
To recreate the same hierarchy as the original Purview, just update the initial start_collection from purview-test-2
to the new purview-uat-1
:
client.create_collections(start_collection='purview-uat-1', collection_names='collection1',safe_delete_friendly_name='collection1')
client.create_collections(start_collection='collection1', collection_names='test1', safe_delete_friendly_name='test1')
client.create_collections(start_collection='test1', collection_names='test2', safe_delete_friendly_name='test2')
client.create_collections(start_collection='test2', collection_names='test3', safe_delete_friendly_name='test3')
client.create_collections(start_collection='test3', collection_names='test4', safe_delete_friendly_name='test4')
The output will be the exact same hierarchy as the original Purview (same actual and friendly names) so it's consistent across environments:
Info
Make sure the Service Principal/user is authenticated to the new Purview and assigned the Collection Admin role on the initial start collection (purview-uat-1
in the example above).