How to fetch just the 'value' from a result set of Key value pair (dict) in Azure #400
-
@jeffreyaven How to fetch just the 'value' from a dict result set in Azure. I need to join it to other tables.
Result is I just need - vmss1. I tried output = 'csv' and was able to get vmss1, but it was adding extra quotes to other json fields. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
hey @vwake7 to get the value from a dictionary use the code below: stackql = StackQL(output='dict')
query = """ select name from azure.compute.virtual_machine_scale_sets where subscriptionId = '%s' and resourceGroupName = 'vmss-flex'; """ % (subscription_id)
res = stackql.execute(query)[0]['name']
print(res)
# or you could do
res = stackql.execute(query)
vmss_name = res[0]['name']
print(vmss_name) this should work, result sets from |
Beta Was this translation helpful? Give feedback.
what's the error you are getting with this @vwake7 the output format shouldn't affect this