3
votes

Is it possible to set an expiration time on the individual rows of a table in BigQuery?

I don't want the entire table to expire, but I would like to be able to set an expiration date on rows. For example, if the expiration date was 31 days, I would like any row that was inserted more than 31 days ago to be removed from the table.

2

2 Answers

4
votes

There is no expiration on row level (at least as of now)!
What you can do to accomplish very similar (by result) is to use relatively recently introduced Partitioned Tables
Each partition can have its own expiration - so you can set your table in such a way that all rows belonging to particular day will expire when you need them to

3
votes

If your table is a partitioned table, you can set an expiration time on the partitions within the table using the timePartitioning.expirationMs field. This could automatically expire a partition after 31 days, for example.