Hey guys. Is possible to setup TTL on Dynamo for ...
# sst
a
Hey guys. Is possible to setup TTL on Dynamo for specific rows? For example, I have some records which are created on an
initial
state, which shouldn’t live forever… only on specific error scenarios that could happen. But on other cases, I don’t want to have TTL on some records, which has the
correct
state. Long story short…. I want to setup TTL for “some” rows and “some not” on the same Dynamo table.
m
This can be done by setting the TTL only when the item reaches the state where you want them deleted.
a
I was thinking to setup TTL only on the initial state, and later remove that value from the item.
So basically… will this work if some rows have
null
in the TTL column and some others has a Date?
m
Oh, yeah I read that wrong. Yes, if you remove or change the TTL attribute, then the item won't delete.
a
Will be a mix of some with TTL and some with null.
Nice.
Thank you for your feedback!
m
np!
s
Keep in mind that DDB does not guarantee when the expired items will be deleted. Therefore, you may need to account for that in your application elsewhere (usually by using a filterExpression to filter out items with expired TTLs)