Home > Blockchain >  How to get a list of measure names in AWS timestream?
How to get a list of measure names in AWS timestream?

Time:08-05

I want to get the list of measures in a timestream table, ie. the result of this query:

SELECT DISTINCT measure_name FROM <db_name>.<table_name>

The problem with this query is that it scans the entire db, which is expensive.

I wonder if there's a better way of getting this list, especially because the AWS console has an option to show the measures ("Show measures" in menu of the table). Screenshot of "Show measures" action in AWS console.

I tried to find a specialized action to do this in the API doc, but couldn't find anything. This left me to wonder if the AWS console runs the above (expensive) query everytime I look at the measures. Does it?

Side note: I need to run this from a python app / through boto3.

CodePudding user response:

It's possible to use a "SHOW" statement.

https://docs.aws.amazon.com/timestream/latest/developerguide/supported-sql-constructs.SHOW.html

SHOW MEASURES FROM database.table [LIKE pattern]
  • Related