Format CLI table query?

I am attempting to execute a CLI command the outputs a simple table with three columns – Data Set ID, Data Source ID, and Data Source Name. The one row would contain the column’s values. I was able to come up with a command that outputs these fields, but the formatting is not ideal. I have attached a screenshot of how it looks in table form. Is there a way to edit the query to produce my desired format?

aws quicksight describe-data-set --aws-account-id ************* --data-set-id *********** --query '{DataSetID:DataSet.DataSetId,DataSourceName:DataSet.PhysicalTableMap.*.*.Name,DataSourceID:DataSet.PhysicalTableMap.*.*.DataSourceArn}' --output table

hi @Ben_Berliner

Thx for reaching out! I will have to do some research on this one. Can you help me understand the ultimate goal with this query?

Ramon Lopez

Hi @Ramon_Lopez,
Thanks for agreeing to help with this! We share QS data sets and data sources across our enterprise and need to know how everything connects.

Look forward to hearing back from you soon.

Warm regards,


Hi @Ben_Berliner

Took me a minute to figure this one out - but i think i got it. Required using the flatten commands with JMESPath.

aws quicksight describe-data-set --aws-account-id 0000000000 --data-set-id 000000000000000000 --query 'DataSet.{DataSetID:DataSetId,DataSourceName:PhysicalTableMap.*[].*[]|[0].Name,DataSourceID:PhysicalTableMap.*[].*[]|[0].DataSourceArn}' --output table

Please confirm this is what you were attempting to do - and if so - mark reply as solution.

Ramon Lopez


@Ramon_Lopez it worked! brilliant! Many thanks!

1 Like

@Ramon_Lopez not sure to post here or start a new topic, but finding a related issue to these results. It seems as if the value populating in the ‘DataSourceName’ field is outputting the Data Set Name, not the data source name. This is confusing because in the “Name” field is nested under the data source’s id according to the response syntax (DescribeDataSet - Amazon QuickSight).

Should the syntax be revised? Or is this field meant to represent the data set name? If so, wouldn’t that be redundant given the fact that the data set name field already appears in this action nested under “dataset”? DescribeDataSet - Amazon QuickSight

Hi Ben

Did q quick test to understand better. and DataSourceName:PhysicalTableMap.[].[]|[0].Name are two separate values. is the final result and one dataset could have multiple datasources.

The datasource listed under physiscal table map seems to be the first table added to the dataset/model.

The logical table map contains Join logic as well as the source datasources. For example my dataset has 2 tables. This creates 3 entries under logicaltablemap. One for the join, one for the 2nd table, and one for the transform/renaming of the 2nd table(as i changed the alias name).

1 Like

Ah, got it, makes sense. Thanks again!!

1 Like