Lizozom
Lizozom

Reputation: 2311

BigQuery: Set expirationTime on a destinationTable

I'm running a query job on a large dataset in BigQuery. The job results are stored in a destinationTable. I want the tables to expire either within 1 day or 1 hour (historical data va. today's data). Is there an option to set expirationTime on each table?

I am aware that I can set a defaultExpirationTime on the entire dataset, but since I have different expiration times, this is not an ideal solution.

Upvotes: 3

Views: 205

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172974

Check expirationTime Table's Property

expirationTime  long    [Optional] The time when this table expires, in milliseconds since 
                        the epoch. If not present, the table will persist indefinitely. 
                        Expired tables will be deleted and their storage reclaimed.

You need to set it using tables.patch API after table is created or updated (depends on your logic)

Upvotes: 1

Related Questions