If you want to filter the results by a specific value, you will need to add a comparison in the query expression. If you want to display all the result fields filtered by value ‘xxx’, it should look like ‘DataSources[?DataSourceParameters.values(@).Host==`xxx`]’. For more examples and explanation, you can go here for documentation on filtering AWS CLI output.
It works fine now … if I may … and how would one filter by Port? When I try to filter by Port I get ‘’
The port number is without quotes: “Port”: 5439
Many thanks,
Art
Please take a look at the documentation related to client side filtering. The output from the AWS CLI command is JSON and you will be able to use standard JMESPath syntax to create the expressions to meet your filtering requirements in the query flag.
I have not tested it, but if you want to filter on two values (Host & Port) where both values need to be true, the expression may be something like ‘DataSources[?DataSourceParameters.RedshiftParameters.Host==`xxx` && DataSourceParameters.RedshiftParameters.Port==`xxx`]’.
Many thanks for your replay however it seems that my question was confusing. I want to find out how I can run the query but without specifying the path ‘name’ as the name can vary. For example your last statement:
I would like to replace ‘RedshiftParameters’ with an index or something else as the name can change to ‘SnowflakeParameters’. So currently to get all values I would have to run two queries: