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
質問済み 6ヶ月前184ビュー
1回答
0
AWS
サポートエンジニア
Kyle_B
回答済み 5ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ