Reputation: 6269
I am using google-cloud-bigquery gem for my Ruby on Rails application. I am able to execute the query on the dataset and do the following
Now I want to set the expiration time for the destination table. I find a document to updating a table. But I am unable to find a way to set the expiration time using Ruby language?
Also I am able to fetch expires_at value from a table which returns nil. I don't find a way to set it.
Kindly help
Upvotes: 0
Views: 1905
Reputation: 14781
I'm no Ruby expert, but I also cannot find anything in the docs/api that allows you to set the expiration on a table. You can do it at the dataset level (here) or for partitions on the table (here). It looks like it's not exposed via the client library for some reason.
Another way of doing it is via DDL in SQL e.g:
ALTER TABLE mydataset.mytable
SET OPTIONS (
expiration_timestamp=TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL 7 DAY),
description="Table that expires seven days from now"
)
Upvotes: 3