Class AccessEntry (2.31.0)

AccessEntry(role, entity_type, entity_id)

Represents grant of an access role to an entity.

An entry must have exactly one of the allowed ENTITY_TYPES. If anything but view or routine are set, a role is also required. role is omitted for view and routine, because they are always read-only.

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

Parameters

NameDescription
role 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 or routine.

entity_type str

Type of entity being granted the role. One of ENTITY_TYPES.

entity_id Union[str, Dict[str, str]]

If the entity_type is not 'view' or 'routine', 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 }

Inheritance

builtins.object > AccessEntry

Properties

entity_id

str: The entity_id of the entry.

entity_type

str: The entity_type of the entry.

role

str: The role of the entry.

Methods

from_api_repr

from_api_repr(resource: dict)

Factory: construct an access entry given its API representation

Parameter
NameDescription
resource Dict[str, object]

Access entry resource representation returned from the API

Exceptions
TypeDescription
ValueErrorIf the resource has more keys than ``role`` and one additional key.
Returns
TypeDescription
google.cloud.bigquery.dataset.AccessEntryAccess entry parsed from ``resource``.

to_api_repr

to_api_repr()

Construct the API resource representation of this access entry

Returns
TypeDescription
Dict[str, object]Access entry represented as an API resource

__init__

__init__(role, entity_type, entity_id)

Initialize self. See help(type(self)) for accurate signature.

AccessEntry

AccessEntry(role, entity_type, entity_id)

Represents grant of an access role to an entity.

An entry must have exactly one of the allowed ENTITY_TYPES. If anything but view or routine are set, a role is also required. role is omitted for view and routine, because they are always read-only.

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

Parameters
NameDescription
role 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 or routine.

entity_type str

Type of entity being granted the role. One of ENTITY_TYPES.

entity_id Union[str, Dict[str, str]]

If the entity_type is not 'view' or 'routine', 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 }

Exceptions
TypeDescription
ValueErrorIf the ``entity_type`` is not among `ENTITY_TYPES`, or if a ``view`` or a ``routine`` has ``role`` set, or a non ``view`` and non ``routine`` **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)