As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

google.cloud.bigquery.table.TableListItem

class google.cloud.bigquery.table.TableListItem(resource)[source]

A read-only table resource from a list operation.

For performance reasons, the BigQuery API only includes some of the table properties when listing tables. Notably, schema and num_rows are missing.

For a full list of the properties that the BigQuery API returns, see the REST documentation for tables.list.

Parameters

resource (Dict[str, object]) – A table-like resource object from a table list response. A tableReference property is required.

Raises

ValueError – If tableReference or one of its required members is missing from resource.

__init__(resource)[source]

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

Methods

__init__(resource)

Initialize self.

from_string(full_table_id)

Construct a table from fully-qualified table ID.

to_api_repr()

Constructs the API resource of this table

to_bqstorage()

Construct a BigQuery Storage API representation of this table.

Attributes

clustering_fields

Fields defining clustering for the table

created

Datetime at which the table was created (None until set from the server).

dataset_id

ID of dataset containing the table.

expires

Datetime at which the table will be deleted.

friendly_name

Title of the table (defaults to None).

full_table_id

ID for the table (None until set from the server).

labels

Labels for the table.

partition_expiration

Expiration time in milliseconds for a partition.

partitioning_type

Time partitioning of the table if it is partitioned (Defaults to None).

path

URL path for the table’s APIs.

project

Project bound to the table.

reference

A TableReference pointing to this table.

table_id

The table ID.

table_type

The type of the table (None until set from the server).

time_partitioning

Configures time-based partitioning for a table.

view_use_legacy_sql

Specifies whether to execute the view with Legacy or Standard SQL.

property clustering_fields

Fields defining clustering for the table

(Defaults to None).

Clustering fields are immutable after table creation.

Note

BigQuery supports clustering for both partitioned and non-partitioned tables.

Type

Union[List[str], None]

property created

Datetime at which the table was created (None until set from the server).

Type

Union[datetime.datetime, None]

property dataset_id: str

ID of dataset containing the table.

property expires

Datetime at which the table will be deleted.

Type

Union[datetime.datetime, None]

property friendly_name

Title of the table (defaults to None).

Type

Union[str, None]

classmethod from_string(full_table_id: str)google.cloud.bigquery.table.TableListItem[source]

Construct a table from fully-qualified table ID.

Parameters

full_table_id (str) – A fully-qualified table ID in standard SQL format. Must included a project ID, dataset ID, and table ID, each separated by ..

Returns

Table parsed from full_table_id.

Return type

Table

Examples

>>> Table.from_string('my-project.mydataset.mytable')
Table(TableRef...(D...('my-project', 'mydataset'), 'mytable'))
Raises

ValueError – If full_table_id is not a fully-qualified table ID in standard SQL format.

property full_table_id

ID for the table (None until set from the server).

In the format project_id:dataset_id.table_id.

Type

Union[str, None]

property labels

Labels for the table.

This method always returns a dict. To change a table’s labels, modify the dict, then call Client.update_table. To delete a label, set its value to None before updating.

Type

Dict[str, str]

property partition_expiration

Expiration time in milliseconds for a partition.

If this property is set and type_ is not set, type_ will default to TimePartitioningType.DAY.

Type

Union[int, None]

property partitioning_type

Time partitioning of the table if it is partitioned (Defaults to None).

Type

Union[str, None]

property path: str

URL path for the table’s APIs.

property project: str

Project bound to the table.

property reference

A TableReference pointing to this table.

Returns

pointer to this table.

Return type

google.cloud.bigquery.table.TableReference

property table_id: str

The table ID.

property table_type

The type of the table (None until set from the server).

Possible values are 'TABLE', 'VIEW', or 'EXTERNAL'.

Type

Union[str, None]

property time_partitioning

Configures time-based partitioning for a table.

Type

google.cloud.bigquery.table.TimePartitioning

to_api_repr()dict[source]

Constructs the API resource of this table

Returns

Table represented as an API resource

Return type

Dict[str, object]

to_bqstorage()str[source]

Construct a BigQuery Storage API representation of this table.

Returns

A reference to this table in the BigQuery Storage API.

Return type

str

property view_use_legacy_sql

Specifies whether to execute the view with Legacy or Standard SQL.

This boolean specifies whether to execute the view with Legacy SQL (True) or Standard SQL (False). The client side default is False. The server-side default is True. If this table is not a view, None is returned.

Raises

ValueError – For invalid value types.

Type

bool