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
feita há 6 meses184 visualizações
1 Resposta
0
AWS
ENGENHEIRO DE SUPORTE
Kyle_B
respondido há 5 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas