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
andnum_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 fromresource
.
Methods
__init__
(resource)Initialize self.
from_string
(full_table_id)Construct a table from fully-qualified table ID.
Constructs the API resource of this table
Construct a BigQuery Storage API representation of this table.
Attributes
Fields defining clustering for the table
Datetime at which the table was created (
None
until set from the server).ID of dataset containing the table.
Datetime at which the table will be deleted.
Title of the table (defaults to
None
).ID for the table (
None
until set from the server).Labels for the table.
Expiration time in milliseconds for a partition.
Time partitioning of the table if it is partitioned (Defaults to
None
).Project bound to the table.
A
TableReference
pointing to this table.ID of the table.
The type of the table (
None
until set from the server).Configures time-based partitioning for a table.
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.
-
property
created
¶ Datetime at which the table was created (
None
until set from the server).- Type
Union[datetime.datetime, None]
-
property
expires
¶ Datetime at which the table will be deleted.
- Type
Union[datetime.datetime, None]
-
classmethod
from_string
(full_table_id)[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
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
.
-
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 toNone
before updating.
-
property
partition_expiration
¶ Expiration time in milliseconds for a partition.
If this property is set and
type_
is not set,type_
will default toTimePartitioningType.DAY
.
-
property
reference
¶ A
TableReference
pointing to this table.- Returns
pointer to this table.
- Return type
-
property
table_type
¶ The type of the table (
None
until set from the server).Possible values are
'TABLE'
,'VIEW'
, or'EXTERNAL'
.
-
property
time_partitioning
¶ Configures time-based partitioning for a table.
-
to_bqstorage
()[source]¶ Construct a BigQuery Storage API representation of this table.
- Returns
A reference to this table in the BigQuery Storage API.
- Return type
-
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 isFalse
. The server-side default isTrue
. If this table is not a view,None
is returned.- Raises
ValueError – For invalid value types.
- Type