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
preguntada hace 6 meses184 visualizaciones
1 Respuesta
0
AWS
INGENIERO DE SOPORTE
Kyle_B
respondido hace 5 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas