Is it possible to extract the schema after scanning an asset in Purview?
Asked
Active
Viewed 700 times
1 Answers
0
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).
Working example for ADLS resource set using purview cli with PowerShell:
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}

CHEEKATLAPRADEEP
- 12,191
- 1
- 19
- 42