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
demandé il y a 6 mois184 vues
1 réponse
0
AWS
INGÉNIEUR EN ASSISTANCE TECHNIQUE
Kyle_B
répondu il y a 5 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions