google.cloud.bigquery.table.TableReference¶
-
class
google.cloud.bigquery.table.
TableReference
(dataset_ref, table_id)[source]¶ TableReferences are pointers to tables.
See https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tablereference
- Parameters
dataset_ref (google.cloud.bigquery.dataset.DatasetReference) – A pointer to the dataset
table_id (str) – The ID of the table
-
__init__
(dataset_ref, table_id)[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.
to_bqstorage
([v1beta1])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.
-
classmethod
from_api_repr
(resource)[source]¶ Factory: construct a table reference given its API representation
-
classmethod
from_string
(table_id, default_project=None)[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.
-
to_bqstorage
(v1beta1=False)[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_v1.types.ReadSession.TableReadOptions
to filter rows by partition. Usegoogle.cloud.bigquery_storage_v1.types.ReadSession.TableModifiers
to select a specific snapshot to read from.- Parameters
v1beta1 (Optiona[bool]) – If
True
, return representation compatible with BigQuery Storagev1beta1
version. Defaults toFalse
.- Returns
- ]:
A reference to this table in the BigQuery Storage API.
- Return type
Union[str, google.cloud.bigquery_storage_v1beta1.types.TableReference
- Raises
ValueError – If
v1beta1
compatibility is requested, but thegoogle.cloud.bigquery_storage_v1beta1
module cannot be imported.