Trying to work out how to escape a hyphen in an XML Tag in Azure SQL Analytics
-
13-03-2021 - |
문제
working with Kusto / KQL to try and parse the deadlock xml in Azure SQL Analytics and getting stuck with escaping the tag name process-list as follows
So the deadlock xml looks like
<deadlock>
<process-list>
...
I want to get one of the attributes under process-list but KQL chokes on the hyphen and I don't know how to escape it to make it work - see the bold section in the last line
AzureDiagnostics | where (Category == "Deadlocks") | where ResourceId contains "/SERVERS/" | where ResourceId contains "/DATABASES/" | where Resource contains "Analytics" | project Resource = strcat(extract(".+/SERVERS/([^/]+)/.+", 1, ResourceId), ".", extract(".+/DATABASES/(.+)", 1, ResourceId)).tolower(), TimeGenerated, deadlock_xml_s | extend DeadlockXML = parse_xml(deadlock_xml_s) | extend KeyDeets = DeadlockXML.deadlock.process-list.waitresource
해결책
...but KQL chokes on the hyphen and I don't know how to escape it to make it work
for example: DeadlockXML.deadlock['process-list'].waitresource