Module dataset (3.25.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 allowed xref_EntityTypes. If anything but view, routine, or dataset are set, a role is also required. role is omitted for view, routine, dataset, because they are always read-only.

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

Parameters
Name Description
role typing.Optional[str]

Role granted to the entity. The following string values are supported: 'READER', 'WRITER', 'OWNER'. It may also be :data:None if the entity_type is view, routine, or dataset.

entity_type typing.Optional[str]

Type of entity being granted the role. See EntityTypes for supported types.

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

If the entity_type is not 'view', 'routine', or 'dataset', the entity_id is the str ID of the entity being granted the role. If the entity_type is 'view' or 'routine', the entity_id is a dict 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 the entity_type is 'dataset', the entity_id is a dict that includes a 'dataset' field with a dict representing the dataset and a 'target_types' field with a str value of the dataset's resource type:: { 'dataset': { 'projectId': string, 'datasetId': string, }, 'target_types: 'VIEWS' }

Exceptions
Type Description
ValueError If a view, routine, or dataset has role set, or a non view, non routine, and non dataset **does not** have a role 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
Name Description
dataset_ref Union[google.cloud.bigquery.dataset.DatasetReference, str]

A pointer to a dataset. If dataset_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 the dataset properties when listing datasets. Notably, xref_access_entries is missing.

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

Parameter
Name Description
resource Dict[str, str]

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

Exceptions
Type Description
ValueError If datasetReference or one of its required members is missing from resource.

DatasetReference

DatasetReference(project: str, dataset_id: str)
Parameters
Name Description
project str

The ID of the project

dataset_id str

The ID of the dataset

Exceptions
Type Description
ValueError If either argument is not of type str.