Extended properties can be accessed in the following four ways:
- All template driven code generation
Template engine reference examples using pebble syntax:
table.extendedPropertyValuesByName["<propertyName>"]
table.loadInfo.sourceConnection.extendedPropertyValuesByName["<propertyName>"]
table.target.connection.extendedPropertyValuesByName["<propertyName>"]
- Automatic token replacement at run-time in Windows scripts
The automatic token replacement applies to Windows based scripts only. Each token is assessed at run-time immediately before executing a script in the same way parameters are replaced:
Token format: $WSL_EXP_<propertyName>$
In the token replacement process, the first non-empty Extended Property value found is replaced in this order of preference:- Table or Export Object
- Associated Source Connection
- Associated Target Connection
If the Extended Property was not found in the associated objects the token is left unchanged. - Calling the WslMetadataServiceClient.dll at run-time from Windows scripts
This is an advanced feature and not recommended for general use as it puts a reliance on loading this DLL at run-time from Windows scripts.
Below, an example on the PowerShell code block inside a RED PowerShell Script:
Add-Type -Path "${env:WSL_BINDIR}WslMetadataServiceClient.dll"
$repo = New-Object WslMetadataServiceClient.Repo("${env:WSL_META_DSN}", 'SQLServer',
"${env:WSL_META_USER}", "${env:WSL_META_PWD}", "${env:WSL_META_SCHEMA}",
"_${env:WSL_META_DSN_ARCH}")
$repo.objectsByName["<objectName>"].extendedPropertyValuesByName["<propertyName>"]
- WhereScape Database Enablement Packs
WhereScape provides Database Enablement Packs for many target platforms, each pack includes a utility template with extended property lookup functions as well as a PowerShell and Python functions to call at run-time. For more information please contact your WhereScaperepresentative.