'Azure Purview - How to extract schema output after the scan?

Is it possible to extract the schema after scanning an asset in Purview?



Solution 1:[1]

This can be achieved by cycling through the referredEntities.

Example: Get the entity information for an Azure SQL Table by using the command - pv entity read --guid "AZURE_SQL_TABLE_GUID"

Within the JSON response, there are referredEntities, which includes the Azure SQL Columns and their classifications (if applicable).

enter image description here

Working example for ADLS resource set using purview cli with PowerShell:

enter image description here

Code Sample:

 $env:PURVIEW_NAME = "YOUR_PURVIEW_ACCOUNT_NAME"
 $guid = "YOUR_ADLS_GEN2_RESOURCE_SET_GUID"
 $adls_resource_set = pv entity read --guid $guid | ConvertFrom-Json
 $tabular_schema_guid = $adls_resource_set.entity.relationshipAttributes.tabular_schema.guid
 $tabular_schema = pv entity read --guid $tabular_schema_guid | ConvertFrom-Json
 ForEach ($x in $tabular_schema.referredEntities.PSObject.Properties) {$x.Value.classifications.typeName}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CHEEKATLAPRADEEP-MSFT