Class Dataset (1.17.0)

Dataset(dataset_ref)

Parameter

Name Description
dataset_ref Union[ 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 ..

Inheritance

builtins.object > Dataset

Properties

access_entries

List[google.cloud.bigquery.dataset.AccessEntry]: Dataset's access entries.

role augments the entity type and must be present unless the entity type is view.

Exceptions
Type Description
TypeError If 'value' is not a sequence
ValueError If any item in the sequence is not an AccessEntry.

created

Union[datetime.datetime, None]: Datetime at which the dataset was created (:data:None until set from the server).

dataset_id

str: Dataset ID.

default_table_expiration_ms

Union[int, None]: Default expiration time for tables in the dataset (defaults to :data:None).

Exceptions
Type Description
ValueError For invalid value types.

description

Union[str, None]: Description of the dataset as set by the user (defaults to :data:None).

Exceptions
Type Description
ValueError for invalid value types.

etag

Union[str, None]: ETag for the dataset resource (:data:None until set from the server).

friendly_name

Union[str, None]: Title of the dataset as set by the user (defaults to :data:None).

Exceptions
Type Description
ValueError for invalid value types.

full_dataset_id

Union[str, None]: ID for the dataset resource (:data:None until set from the server)

In the format project_id:dataset_id.

labels

Dict[str, str]: Labels for the dataset.

This method always returns a dict. To change a dataset's labels, modify the dict, then call xref_update_dataset. To delete a label, set its value to :data:None before updating.

Exceptions
Type Description
ValueError for invalid value types.

location

Union[str, None]: Location in which the dataset is hosted as set by the user (defaults to :data:None).

Exceptions
Type Description
ValueError for invalid value types.

modified

Union[datetime.datetime, None]: Datetime at which the dataset was last modified (:data:None until set from the server).

path

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

project

str: Project ID of the project bound to the dataset.

reference

google.cloud.bigquery.dataset.DatasetReference: A reference to this dataset.

Union[str, None]: URL for the dataset resource (:data:None until set from the server).

Methods

__init__

__init__(dataset_ref)

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

from_api_repr

from_api_repr(resource)

Factory: construct a dataset given its API representation

Returns
Type Description
google.cloud.bigquery.dataset.Dataset Dataset parsed from ``resource``.

from_string

from_string(full_dataset_id)

Construct a dataset from fully-qualified dataset ID.

Parameter
Name Description
full_dataset_id str

A fully-qualified dataset ID in standard SQL format. Must included both the project ID and the dataset ID, separated by ..

Exceptions
Type Description
ValueError If ``full_dataset_id`` is not a fully-qualified dataset ID in standard SQL format.
Returns
Type Description
Dataset .. rubric:: Examples >>> Dataset.from_string('my-project-id.some_dataset') Dataset(DatasetReference('my-project-id', 'some_dataset')) Dataset parsed from ``full_dataset_id``.

model

model(model_id)

Constructs a ModelReference.

Parameter
Name Description
model_id str

the ID of the model.

Returns
Type Description
google.cloud.bigquery.model.ModelReference A ModelReference for a model in this dataset.

routine

routine(routine_id)

Constructs a RoutineReference.

Parameter
Name Description
routine_id str

the ID of the routine.

Returns
Type Description
google.cloud.bigquery.routine.RoutineReference A RoutineReference for a routine in this dataset.

table

table(table_id)

Constructs a TableReference.

Parameter
Name Description
table_id str

The ID of the table.

Returns
Type Description
google.cloud.bigquery.table.TableReference A table reference for a table in this dataset.

to_api_repr

to_api_repr()

Construct the API resource representation of this dataset

Returns
Type Description
Dict[str, object] The dataset represented as an API resource

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

Last updated 2025年09月18日 UTC.