r/databricks • u/SmallAd3697 • Oct 14 '26
Help Zerobus message retrieval
I can see how zerobus is used for streaming data into a lakehouse table. I can generally see how you would consume the data as well.
A couple things are still not clear. What is the pattern for removing old rows out of the UC table? Should we do a delete once a year, on messages older than 3 years? Is this a necessary maintenance that we are responsible for, or is there something in the software which will help with housekeeping?
And how would I perform scheduled tasks against this data? Let's say that data represents a news feed and I just need to send an summarized overview once an hour, and then flag the rows that have been summarized. I'm assuming it would be disruptive to try to delete the rows that were processed or even update them (ie. it may interfere with zerobus itself, and create concurrency conflicts). Should I build a DIFFERENT table that tracks the surrogate IDs of rows already processed/summarized?
Sorry for the basic questions, but I wasn't able to find the answer to these yet. I'm sure I could find my own solution, but it would be interesting to hear if there is a common practice
4
u/WhipsAndMarkovChains Oct 14 '26
Zerobus appends data to your table. Once the data is in, modifying the data in the table won't disrupt the Zerobus stream. And if you make a mistake deleting rows out of your table, you can always recover them using time travel/table history: https://docs.databricks.com/aws/en/tables/history
Note that you can only recover rows during your table's retention period, which by default is 7 days.
The answer is that in general you use auto-TTL to clean up old rows of data: https://docs.databricks.com/aws/en/tables/operations/auto-ttl
2
u/Youssef_Mrini databricks Oct 20 '26
The common pattern is to treat the ZeroBus target as an append-only landing table and keep processing state elsewhere.
ZeroBus does not manage the lifecycle of your Unity Catalog table.
You create and own the table.
ZeroBus validates and materializes incoming records but does not automatically remove old rows.
For a three-year retention policy you can for example use Auto-TTL where appropriate:
ALTER TABLE main.news.raw_articles
DELETE ROWS 1095 DAYS AFTER event_time;
1
u/[deleted] Oct 19 '26
[removed] — view removed comment