google.cloud.bigquery.dataset.DatasetReference#

Methods

from_api_repr(resource)

Factory: construct a dataset reference given its API representation

from_string(dataset_id[, default_project])

Construct a dataset reference from dataset ID string.

model(model_id)

Constructs a ModelReference.

routine(routine_id)

Constructs a RoutineReference.

table(table_id)

Constructs a TableReference.

to_api_repr()

Construct the API resource representation of this dataset reference

Attributes

dataset_id

Dataset ID.

path

URL path for the dataset based on project and dataset ID.

project

Project ID of the dataset.


class google.cloud.bigquery.dataset.DatasetReference(project, dataset_id)[source]#

Bases: object

DatasetReferences are pointers to datasets.

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

Parameters
  • project (str) – The ID of the project

  • dataset_id (str) – The ID of the dataset

Raises

ValueError – If either argument is not of type str.

property dataset_id#

Dataset ID.

Type

str

classmethod from_api_repr(resource)[source]#

Factory: construct a dataset reference given its API representation

Parameters

resource (Dict[str, str]) – Dataset reference resource representation returned from the API

Returns

Dataset reference parsed from resource.

Return type

google.cloud.bigquery.dataset.DatasetReference

classmethod from_string(dataset_id, default_project=None)[source]#

Construct a dataset reference from dataset ID string.

Parameters
  • dataset_id (str) – A dataset ID in standard SQL format. If default_project is not specified, this must include both the project ID and the dataset ID, separated by ..

  • default_project (str) – Optional. The project ID to use when dataset_id does not include a project ID.

Returns

Dataset reference parsed from dataset_id.

Return type

DatasetReference

Examples

>>> DatasetReference.from_string('my-project-id.some_dataset')
DatasetReference('my-project-id', 'some_dataset')
Raises

ValueError – If dataset_id is not a fully-qualified dataset ID in standard SQL format.

model(model_id)#

Constructs a ModelReference.

Parameters

model_id (str) – the ID of the model.

Returns

A ModelReference for a model in this dataset.

Return type

google.cloud.bigquery.model.ModelReference

property path#

URL path for the dataset based on project and dataset ID.

Type

str

property project#

Project ID of the dataset.

Type

str

routine(routine_id)#

Constructs a RoutineReference.

Parameters

routine_id (str) – the ID of the routine.

Returns

A RoutineReference for a routine in this dataset.

Return type

google.cloud.bigquery.routine.RoutineReference

table(table_id)#

Constructs a TableReference.

Parameters

table_id (str) – The ID of the table.

Returns

A table reference for a table in this dataset.

Return type

google.cloud.bigquery.table.TableReference

to_api_repr()[source]#

Construct the API resource representation of this dataset reference

Returns

dataset reference represented as an API resource

Return type

Dict[str, str]