Class Table (3.14.1)

Table(table_ref,schema=None)

Parameters

NameDescription
table_refUnion[google.cloud.bigquery.table.TableReference, str]

A pointer to a table. Iftable_ref is a string, it must included a project ID, dataset ID, and table ID, each separated by..

schemaOptional[Sequence[Union[SchemaField, Mapping[str, Any] ]]]

The table's schema. If any item is a mapping, its content must be compatible withfrom_api_repr.

Properties

clone_definition

Information about the clone. This value is set via clone creation.

See:https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.clone_definition

clustering_fields

Union[List[str], None]: Fields defining clustering for the table

(Defaults to :data:None).

Clustering fields are immutable after table creation.

Note:BigQuery supports clustering for both partitioned andnon-partitioned tables.

created

dataset_id

description

Exceptions
TypeDescription
ValueErrorFor invalid value types.

encryption_configuration

google.cloud.bigquery.encryption_configuration.EncryptionConfiguration: Customencryption configuration for the table.

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

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

etag

Union[str, None]: ETag for the table resource (:data:None untilset from the server).

expires

Union[datetime.datetime, None]: Datetime at which the table will bedeleted.

Exceptions
TypeDescription
ValueErrorFor invalid value types.

external_data_configuration

Union[google.cloud.bigquery.ExternalConfig, None]: Configuration foran external data source (defaults to :data:None).

Exceptions
TypeDescription
ValueErrorFor invalid value types.

friendly_name

Union[str, None]: Title of the table (defaults to :data:None).

Exceptions
TypeDescription
ValueErrorFor invalid value types.

full_table_id

Union[str, None]: ID for the table (:data:None until set from theserver).

In the formatproject-id:dataset_id.table_id.

labels

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

This method always returns a dict. To change a table's labels,modify the dict, then callClient.update_table. To delete alabel, set its value to :data:None before updating.

Exceptions
TypeDescription
ValueErrorIfvalue type is invalid.

location

Union[str, None]: Location in which the table is hosted

Defaults to :data:None.

modified

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

mview_enable_refresh

Optional[bool]: Enable automatic refresh of the materialized viewwhen the base table is updated. The default value is :data:True.

mview_last_refresh_time

Optional[datetime.datetime]: Datetime at which the materialized view was lastrefreshed (:data:None until set from the server).

mview_query

Optional[str]: SQL query defining the table as a materializedview (defaults to :data:None).

mview_refresh_interval

Optional[datetime.timedelta]: The maximum frequency at which thismaterialized view will be refreshed. The default value is 1800000milliseconds (30 minutes).

num_bytes

Union[int, None]: The size of the table in bytes (:data:None untilset from the server).

num_rows

Union[int, None]: The number of rows in the table (:data:Noneuntil set from the server).

partition_expiration

Union[int, None]: Expiration time in milliseconds for a partition.

Ifpartition_expiration is set andtype_ isnot set,type_ will default toDAY.

partitioning_type

Union[str, None]: Time partitioning of the table if it ispartitioned (Defaults to :data:None).

path

URL path for the table's APIs.

project

Project bound to the table.

range_partitioning

Exceptions
TypeDescription
ValueErrorIf the value is notRangePartitioning or :data:None.

reference

Returns
TypeDescription
google.cloud.bigquery.table.TableReferencepointer to this table.

require_partition_filter

schema

Exceptions
TypeDescription
ExceptionIfschema is not a sequence, or if any item in the sequence is not aSchemaField instance or a compatible mapping representation of the field.

self_link

snapshot_definition

streaming_buffer

google.cloud.bigquery.StreamingBuffer: Information about a table'sstreaming buffer.

table_id

The table ID.

table_type

Union[str, None]: The type of the table (:data:None until set fromthe server).

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

time_partitioning

Optional[google.cloud.bigquery.table.TimePartitioning]: Configures time-basedpartitioning for a table.

Only specify at most one ofxref_time_partitioning orxref_range_partitioning.

Exceptions
TypeDescription
ValueErrorIf the value is notTimePartitioning or :data:None.

view_query

Union[str, None]: SQL query defining the table as a view (defaultsto :data:None).

By default, the query is treated as Standard SQL. To use LegacySQL, setview_use_legacy_sql to :data:True.

Exceptions
TypeDescription
ValueErrorFor invalid value types.

view_use_legacy_sql

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

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

Exceptions
TypeDescription
ValueErrorFor invalid value types.

Methods

from_api_repr

from_api_repr(resource:dict)->google.cloud.bigquery.table.Table

Factory: construct a table given its API representation

Parameter
NameDescription
resourceDict[str, object]

Table resource representation from the API

Exceptions
TypeDescription
KeyErrorIf theresource lacks the key'tableReference', or if thedict stored within the key'tableReference' lacks the keys'tableId','projectId', or'datasetId'.
Returns
TypeDescription
google.cloud.bigquery.table.TableTable parsed fromresource.

from_string

from_string(full_table_id:str)->google.cloud.bigquery.table.Table

Construct a table from fully-qualified table ID.

Parameter
NameDescription
full_table_idstr

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

Exceptions
TypeDescription
ValueErrorIffull_table_id is not a fully-qualified table ID in standard SQL format.
Returns
TypeDescription
Table .. rubric:: Examples >>> Table.from_string('my-project.mydataset.mytable') Table(TableRef...(D...('my-project', 'mydataset'), 'mytable'))Table parsed fromfull_table_id.

to_api_repr

to_api_repr()->dict

Constructs the API resource of this table

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

to_bqstorage

to_bqstorage()->str

Construct a BigQuery Storage API representation of this table.

Returns
TypeDescription
strA reference to this table in the BigQuery Storage API.

__init__

__init__(table_ref,schema=None)->None

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

Table

Table(table_ref,schema=None)

Tables represent a set of rows whose values correspond to a schema.

Seehttps://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource-table

Parameters
NameDescription
table_refUnion[google.cloud.bigquery.table.TableReference, str]

A pointer to a table. Iftable_ref is a string, it must included a project ID, dataset ID, and table ID, each separated by..

schemaOptional[Sequence[Union[SchemaField, Mapping[str, Any] ]]]

The table's schema. If any item is a mapping, its content must be compatible withfrom_api_repr.

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

Last updated 2026-01-09 UTC.