Failed queries when there's no data yet

0

I have this recurring problem. I construct a web service (lambda + api gateway) that is running some query in timestream, but that query fails because there doesn't happen to be any data in the table that has that column. Because of the way the schema in Timestream is dynamic if you select "someColumn" and there's no data that includes that column yet the query will fail.

You can work around this by selecting * but that's generally a bad idea. In the case of timestream, it also causes you to select more data than you might want, which costs you money.

I think what I'd prefer would be an option that says if this column doesn't exist just don't return it, but don't declare the entire query invalid. Is that possible?

In the short term, I get around this by writing a garbage data record to the table. This isn't great, and I'm not sure what is going to happen when that garbage data gets expired - will Timestream still think the "column" exists?

Is there a better workaround for this? For example, can I somehow pre-populate the schema?

profile picture
wz2b
asked 6 months ago169 views
1 Answer
0
AWS
SUPPORT ENGINEER
Kyle_B
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions