google.cloud.bigquery.table.TableReference¶
- class google.cloud.bigquery.table.TableReference(dataset_ref: DatasetReference, table_id: str)[source]¶
TableReferences are pointers to tables.
See https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tablereference
- Parameters
dataset_ref – A pointer to the dataset
table_id – The ID of the table
- __init__(dataset_ref: DatasetReference, table_id: str)[source]¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(dataset_ref, table_id)Initialize self.
from_api_repr
(resource)Factory: construct a table reference given its API representation
from_string
(table_id[, default_project])Construct a table reference from table ID string.
Construct the API resource representation of this table reference.
Construct a BigQuery Storage API representation of this table.
Attributes
ID of dataset containing the table.
URL path for the table’s APIs.
Project bound to the table.
The table ID.
- property dataset_id: str¶
ID of dataset containing the table.
- classmethod from_api_repr(resource: dict) → google.cloud.bigquery.table.TableReference[source]¶
Factory: construct a table reference given its API representation
- classmethod from_string(table_id: str, default_project: Optional[str] = None) → google.cloud.bigquery.table.TableReference[source]¶
Construct a table reference from table ID string.
- Parameters
- Returns
Table reference parsed from
table_id
.- Return type
Examples
>>> TableReference.from_string('my-project.mydataset.mytable') TableRef...(DatasetRef...('my-project', 'mydataset'), 'mytable')
- Raises
ValueError – If
table_id
is not a fully-qualified table ID in standard SQL format.
- property path: str¶
URL path for the table’s APIs.
- property project: str¶
Project bound to the table.
- property table_id: str¶
The table ID.
- to_bqstorage() → str[source]¶
Construct a BigQuery Storage API representation of this table.
Install the
google-cloud-bigquery-storage
package to use this feature.If the
table_id
contains a partition identifier (e.g.my_table$201812
) or a snapshot identifier (e.g.mytable@1234567890
), it is ignored. Usegoogle.cloud.bigquery_storage.types.ReadSession.TableReadOptions
to filter rows by partition. Usegoogle.cloud.bigquery_storage.types.ReadSession.TableModifiers
to select a specific snapshot to read from.- Returns
A reference to this table in the BigQuery Storage API.
- Return type