Module dataset (3.29.0)

Define API Datasets.

Classes

AccessEntry

AccessEntry(role:typing.Optional[str]=None,entity_type:typing.Optional[str]=None,entity_id:typing.Optional[typing.Union[typing.Dict[str,typing.Any],str]]=None,)

Represents grant of an access role to an entity.

An entry must have exactly one of the allowedxref_EntityTypes. If anything butview,routine,ordataset are set, arole is also required.role is omitted forview,routine,dataset, because they are always read-only.

Seehttps://cloud.google.com/bigquery/docs/reference/rest/v2/datasets.

Parameters
NameDescription
roletyping.Optional[str]

Role granted to the entity. The following string values are supported:'READER','WRITER','OWNER'. It may also be :data:None if theentity_type isview,routine, ordataset.

entity_typetyping.Optional[str]

Type of entity being granted the role. SeeEntityTypes for supported types.

entity_idtyping.Union[typing.Dict[str, typing.Any], str, NoneType]

If theentity_type is not 'view', 'routine', or 'dataset', theentity_id is thestr ID of the entity being granted the role. If theentity_type is 'view' or 'routine', theentity_id is adict representing the view or routine from a different dataset to grant access to in the following format for views:: { 'projectId': string, 'datasetId': string, 'tableId': string } For routines:: { 'projectId': string, 'datasetId': string, 'routineId': string } If theentity_type is 'dataset', theentity_id is adict that includes a 'dataset' field with adict representing the dataset and a 'target_types' field with astr value of the dataset's resource type:: { 'dataset': { 'projectId': string, 'datasetId': string, }, 'target_types: 'VIEWS' }

Exceptions
TypeDescription
ValueErrorIf aview,routine, ordataset hasrole set, or a nonview, nonroutine, and nondataset **does not** have arole set. .. rubric:: Examples >>> entry = AccessEntry('OWNER', 'userByEmail', 'user@example.com') >>> view = { ... 'projectId': 'my-project', ... 'datasetId': 'my_dataset', ... 'tableId': 'my_table' ... } >>> entry = AccessEntry(None, 'view', view)

Dataset

Dataset(dataset_ref)
Parameter
NameDescription
dataset_refUnion[google.cloud.bigquery.dataset.DatasetReference, str]

A pointer to a dataset. Ifdataset_ref is a string, it must include both the project ID and the dataset ID, separated by..

DatasetListItem

DatasetListItem(resource)

A read-only dataset resource from a list operation.

For performance reasons, the BigQuery API only includes some of thedataset properties when listing datasets. Notably,xref_access_entries is missing.

For a full list of the properties that the BigQuery API returns, see theREST documentation for datasets.list<https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/list>_.

Parameter
NameDescription
resourceDict[str, str]

A dataset-like resource object from a dataset list response. AdatasetReference property is required.

Exceptions
TypeDescription
ValueErrorIfdatasetReference or one of its required members is missing fromresource.

DatasetReference

DatasetReference(project:str,dataset_id:str)
Parameters
NameDescription
projectstr

The ID of the project

dataset_idstr

The ID of the dataset

Exceptions
TypeDescription
ValueErrorIf either argument is not of typestr.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-16 UTC.