Home > Mobile >  Does updating the expirationTime of a table via the Google BigQuery API also update the GBQ UI?
Does updating the expirationTime of a table via the Google BigQuery API also update the GBQ UI?

Time:06-18

Forgive me for asking such a simple question, I've been asked to look into this on behalf of some Developers I work with.

When using the BigQuery API to update the enter image description here

After: enter image description here

Code Sample:

import datetime

from google.cloud import bigquery
client = bigquery.Client(project='elzagales')
project = client.project
dataset_ref = bigquery.DatasetReference(project, 'so_test')
table_ref = dataset_ref.table('table_1')
table = client.get_table(table_ref)  # API request

assert table.expires is None

# set table to expire 5 days from now
expiration = datetime.datetime.now(datetime.timezone.utc)   datetime.timedelta(
    days=5
)
table.expires = expiration
table = client.update_table(table, ["expires"])  # API request

# expiration is stored in milliseconds
margin = datetime.timedelta(microseconds=1000)
assert expiration - margin <= table.expires <= expiration   margin

example reference: https://cloud.google.com/bigquery/docs/managing-tables#updating_a_tables_expiration_time

  • Related