Table output cannot handle non-toplevel arrays
See original GitHub issueThere appears to be an issue where the -o table
type cannot handle non-toplevel arrays. This is visible by running through some steps from an upcoming conceptual tutorial document:
az group create --name TutorialResources --location eastus
az vm create --resource-group TutorialResources \
--name TutorialVM1 \
--image UbuntuLTS \
--generate-ssh-keys \
--verbose
NIC_ID=$(az vm show -n TutorialVM1 -g TutorialResources \
--query 'networkProfile.networkInterfaces[].id' \
-o tsv)
az network nic show --ids $NIC_ID \
-g TutorialResources \
--query '{IP:ipConfigurations[].publicIpAddress.id, Subnet:ipConfigurations[].subnet.id}' \
-o json
{
"IP": [
"/subscriptions/.../resourceGroups/TutorialResources/providers/Microsoft.Network/publicIPAddresses/TutorialVM1PublicIP"
],
"Subnet": [
"/subscriptions/.../resourceGroups/TutorialResources/providers/Microsoft.Network/virtualNetworks/TutorialVM1VNET/subnets/TutorialVM1Subnet"
]
}
However, if we change the last command to use -o table
instead, no output is printed.
az network nic show --ids $NIC_ID \
-g TutorialResources \
--query '{IP:ipConfigurations[].publicIpAddress.id, Subnet:ipConfigurations[].subnet.id}' \
-o table
Environment summary
Ubuntu 16 LTS (on WSL) zsh Installed via package az --version: 2.0.25
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Confused about CSV table output - Power Platform Community
Outside of the condition but within the scope, I create a table that has (should have) the output of the array. Then save...
Read more >Table array with named variables that can contain different types
Tables store each piece of column-oriented data in a variable. Table variables can have different data types and sizes as long as all...
Read more >Work with arrays | BigQuery - Google Cloud
To return the rows of a table where the array column contains a specific value, filter the results of IN UNNEST using the...
Read more >Turn two arrays output into a table with dynamic updating in ...
I want to take the two arrays and output them in table format dynamically so I can change the color of the text...
Read more >Querying arrays with complex types and nested structures
When you query tables within Athena, you do not need to create ROW data types, as they are already created from your data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gsacavdm That’s a separate issue. There are a few keys we skip currently automatically and
id
is one of them. This is due toid
appearing in almost every command result and them being very long so it’s atypical that you’d want to see it in the default table output of commands.Change the key name and it will appear. https://github.com/Microsoft/knack/blob/master/knack/output.py#L152
If this is a real issue to you, please open a separate issue. 😃
While we understand the scenario here, currently table requires some specific format to operate and moving it to be more free-form has unintended side-effects and additionally does not promote consistency.