Xiaomeng Yi
Xiaomeng Yi

Reputation: 137

How can I set expiration time for Big Query table?

When I'm loading or save query to table, Is it possible to set up table expiration time with BQ command line tool ?

Upvotes: 3

Views: 5778

Answers (1)

DoiT International
DoiT International

Reputation: 2435

To set the expiration time on an existing BigQuery table using command line:

bq update --expiration 3600 mydataset.mytable

This example sets the expiration time of mytable in mydataset to 1 hour from now (3600 seconds). You can also specify "0" to remove existing expiration from your table.

Another way of doing this is by setting default expiration on a dataset. Every new table you create in this dataset will have the expiration time according to the setting. An example:

bq update --default_table_expiration 3600 mydataset

Every new table created in mydataset will only be available for one hour before it expires automatically.

Upvotes: 10

Related Questions