Search code examples
amazon-web-servicesamazon-timestream

Column does not exist AWS Timestream Query error


I am trying to apply WHERE clause on DIMENSION of the AWS Timestream records. However, I got the error: Column does not exist

Here is my table schema: The table schema The table measure

First, I will show all the sample data I put in the table

SELECT username, time, manual_usage
FROM "meter-reading"."meter-metrics"
ORDER BY time DESC
LIMIT 4

The result: Result

What I wanted to do is to query and filter the records by the Dimension ("username" specifically).

SELECT * 
FROM "meter-reading"."meter-metrics" 
WHERE measure_name = "OnceADay"
ORDER BY time DESC LIMIT 10 

Then I got the Error: Column 'OnceADay' does not exist

I tried to search for any quotas for Dimensions name and check for error in my schema:

But I didn't find that my "username" for the dimension violate any of the above rules. I checked for some other queries by AWS Blog, the author used the WHERE clause for the Dimension filter normally:


Solution

  • I figured it out after I tried with the sample code. Turn out it was a silly mistake I believe.

    Using apostrophe (') instead of single quotation marks ("") solved my problem.

    SELECT * 
    FROM "meter-reading"."meter-metrics" 
    WHERE username = 'OnceADay'
    ORDER BY time DESC LIMIT 10