@snippet
def dataset_update(client, to_delete):
 DATASET_NAME = ('dataset_update_%d' % (_millis(),))
 dataset = client.dataset(DATASET_NAME)
 dataset.description = ORIGINAL_DESCRIPTION
 dataset.create()
 to_delete.append(dataset)
 dataset.reload()
 from google.cloud.bigquery import AccessGrant
 assert (dataset.description == ORIGINAL_DESCRIPTION)
 assert (dataset.default_table_expiration_ms is None)
 grant = AccessGrant(role='READER', entity_type='domain', entity_id='example.com')
 assert (grant not in dataset.access_grants)
 ONE_DAY_MS = (((24 * 60) * 60) * 1000)
 dataset.description = UPDATED_DESCRIPTION
 dataset.default_table_expiration_ms = ONE_DAY_MS
 grants = list(dataset.access_grants)
 grants.append(grant)
 dataset.access_grants = grants
 dataset.update()
 assert (dataset.description == UPDATED_DESCRIPTION)
 assert (dataset.default_table_expiration_ms == ONE_DAY_MS)
 assert (grant in dataset.access_grants)

@ snippet def dataset_update ( client , to_delete ) : DATASET_NAME = ( 'dataset_update_%d' % ( _millis ( ) , ) ) dataset = client . dataset ( DATASET_NAME ) dataset . description = ORIGINAL_DESCRIPTION dataset . create ( ) to_delete . append ( dataset ) dataset . reload ( ) from google . cloud . bigquery import AccessGrant assert ( dataset . description == ORIGINAL_DESCRIPTION ) assert ( dataset . default_table_expiration_ms is None ) grant = AccessGrant ( role = 'READER' , entity_type = 'domain' , entity_id = 'example.com' ) assert ( grant not in dataset . access_grants ) ONE_DAY_MS = ( ( ( 24 * 60 ) * 60 ) * 1000 ) dataset . description = UPDATED_DESCRIPTION dataset . default_table_expiration_ms = ONE_DAY_MS grants = list ( dataset . access_grants ) grants . append ( grant ) dataset . access_grants = grants dataset . update ( ) assert ( dataset . description == UPDATED_DESCRIPTION ) assert ( dataset . default_table_expiration_ms == ONE_DAY_MS ) assert ( grant in dataset . access_grants )
update a datasets metadata .