Class Dataset (3.4.0)

Stay organized with collections Save and categorize content based on your preferences.
Dataset(dataset_ref)

Parameter

NameDescription
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 ..

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

Exceptions
TypeDescription
TypeErrorIf 'value' is not a sequence
ValueErrorIf 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_encryption_configuration

google.cloud.bigquery.encryption_configuration.EncryptionConfiguration: Custom encryption configuration for all tables in the dataset.

Custom encryption configuration (e.g., Cloud KMS keys) or :data:None if using default encryption.

See protecting data with Cloud KMS keys <https://cloud.google.com/bigquery/docs/customer-managed-encryption>;_ in the BigQuery documentation.

default_partition_expiration_ms

Optional[int]: The default partition expiration for all partitioned tables in the dataset, in milliseconds.

Once this property is set, all newly-created partitioned tables in the dataset will have an time_paritioning.expiration_ms property set to this value, and changing the value will only affect new tables, not existing ones. The storage in a partition will have an expiration time of its partition time plus this value.

Setting this property overrides the use of default_table_expiration_ms for partitioned tables: only one of default_table_expiration_ms and default_partition_expiration_ms will be used for any new partitioned table. If you provide an explicit time_partitioning.expiration_ms when creating or updating a partitioned table, that value takes precedence over the default partition expiration time indicated by this property.

default_table_expiration_ms

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

Exceptions
TypeDescription
ValueErrorFor invalid value types.

description

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

Exceptions
TypeDescription
ValueErrorfor 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
TypeDescription
ValueErrorfor 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
TypeDescription
ValueErrorfor invalid value types.

location

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

Exceptions
TypeDescription
ValueErrorfor 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

from_api_repr

from_api_repr(resource: dict)

Factory: construct a dataset given its API representation

Returns
TypeDescription
google.cloud.bigquery.dataset.DatasetDataset parsed from resource.

from_string

from_string(full_dataset_id: str)

Construct a dataset from fully-qualified dataset ID.

Parameter
NameDescription
full_dataset_id str

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

Exceptions
TypeDescription
ValueErrorIf full_dataset_id is not a fully-qualified dataset ID in standard SQL format.
Returns
TypeDescription
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
NameDescription
model_id str

the ID of the model.

Returns
TypeDescription
google.cloud.bigquery.model.ModelReferenceA ModelReference for a model in this dataset.

routine

routine(routine_id)

Constructs a RoutineReference.

Parameter
NameDescription
routine_id str

the ID of the routine.

Returns
TypeDescription
google.cloud.bigquery.routine.RoutineReferenceA RoutineReference for a routine in this dataset.

table

table(table_id: str)

Constructs a TableReference.

Parameter
NameDescription
table_id str

The ID of the table.

Returns
TypeDescription
google.cloud.bigquery.table.TableReferenceA table reference for a table in this dataset.

to_api_repr

to_api_repr()

Construct the API resource representation of this dataset

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

__init__

__init__(dataset_ref)

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

Dataset

Dataset(dataset_ref)
Parameter
NameDescription
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 ..