Skip to main content

tables

Creates, updates, deletes, gets or lists a tables resource.

Overview

Nametables
TypeResource
Idgoogle.bigtableadmin.tables

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe unique name of the table. Values are of the form projects/{project}/instances/{instance}/tables/_a-zA-Z0-9*. Views: NAME_ONLY, SCHEMA_VIEW, REPLICATION_VIEW, STATS_VIEW, FULL
automatedBackupPolicyobjectIf specified, automated backups are enabled for this table. Otherwise, automated backups are disabled. (id: AutomatedBackupPolicy)
changeStreamConfigobjectIf specified, enable the change stream on this table. Otherwise, the change stream is disabled and the change stream is not retained. (id: ChangeStreamConfig)
clusterStatesobjectOutput only. Map from cluster ID to per-cluster table state. If it could not be determined whether or not the table has data in a particular cluster (for example, if its zone is unavailable), then there will be an entry for the cluster with UNKNOWN replication_status. Views: REPLICATION_VIEW, ENCRYPTION_VIEW, FULL
columnFamiliesobjectThe column families configured for this table, mapped by column family ID. Views: SCHEMA_VIEW, STATS_VIEW, FULL
deletionProtectionbooleanSet to true to make the table protected against data loss. i.e. deleting the following resources through Admin APIs are prohibited: * The table. * The column families in the table. * The instance containing the table. Note one can still delete the data stored in the table through Data APIs.
granularitystringImmutable. The granularity (i.e. MILLIS) at which timestamps are stored in this table. Timestamps not matching the granularity will be rejected. If unspecified at creation time, the value will be set to MILLIS. Views: SCHEMA_VIEW, FULL.
restoreInfoobjectOutput only. If this table was restored from another data source (e.g. a backup), this field will be populated with information about the restore. (id: RestoreInfo)
rowKeySchemaobjectThe row key schema for this table. The schema is used to decode the raw row key bytes into a structured format. The order of field declarations in this schema is important, as it reflects how the raw row key bytes are structured. Currently, this only affects how the key is read via a GoogleSQL query from the ExecuteQuery API. For a SQL query, the _key column is still read as raw bytes. But queries can reference the key fields by name, which will be decoded from _key using provided type and encoding. Queries that reference key fields will fail if they encounter an invalid row key. For example, if _key = "some_id#2024-04-30#\x00\x13\x00\xf3" with the following schema: { fields { field_name: "id" type { string { encoding: utf8_bytes {} } } } fields { field_name: "date" type { string { encoding: utf8_bytes {} } } } fields { field_name: "product_code" type { int64 { encoding: big_endian_bytes {} } } } encoding { delimited_bytes { delimiter: "#" } } } The decoded key parts would be: id = "some_id", date = "2024-04-30", product_code = 1245427 The query "SELECT _key, product_code FROM table" will return two columns: /------------------------------------------------------\ | _key | product_code | | --------------------------------------|--------------| | "some_id#2024-04-30#\x00\x13\x00\xf3" | 1245427 | ------------------------------------------------------/ The schema has the following invariants: (1) The decoded field values are order-preserved. For read, the field values will be decoded in sorted mode from the raw bytes. (2) Every field in the schema must specify a non-empty name. (3) Every field must specify a type with an associated encoding. The type is limited to scalar types only: Array, Map, Aggregate, and Struct are not allowed. (4) The field names must not collide with existing column family names and reserved keywords "_key" and "_timestamp". The following update operations are allowed for row_key_schema: - Update from an empty schema to a new schema. - Remove the existing schema. This operation requires setting the ignore_warnings flag to true, since it might be a backward incompatible change. Without the flag, the update request will fail with an INVALID_ARGUMENT error. Any other row key schema update operation (e.g. update existing schema columns names or types) is currently unsupported. (id: GoogleBigtableAdminV2TypeStruct)
statsobjectOutput only. Only available with STATS_VIEW, this includes summary statistics about the entire table contents. For statistics about a specific column family, see ColumnFamilyStats in the mapped ColumnFamily collection above. (id: TableStats)
tieredStorageConfigobjectRules to specify what data is stored in each storage tier. Different tiers store data differently, providing different trade-offs between cost and performance. Different parts of a table can be stored separately on different tiers. If a config is specified, tiered storage is enabled for this table. Otherwise, tiered storage is disabled. Only SSD instances can configure tiered storage. (id: TieredStorageConfig)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, instancesId, tablesIdviewGets metadata information about the specified table.
listselectprojectsId, instancesIdview, pageSize, pageTokenLists all tables served from a specified instance.
createinsertprojectsId, instancesIdCreates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.
patchupdateprojectsId, instancesId, tablesIdupdateMask, ignoreWarningsUpdates a specified table.
deletedeleteprojectsId, instancesId, tablesIdPermanently deletes a specified table and all of its data.
undeleteexecprojectsId, instancesId, tablesIdRestores a specified table which was accidentally deleted.
modify_column_familiesexecprojectsId, instancesId, tablesIdPerforms a series of column family modifications on the specified table. Either all or none of the modifications will occur before this method returns, but data requests received prior to that point may see a table where only some modifications have taken effect.
drop_row_rangeexecprojectsId, instancesId, tablesIdPermanently drop/delete a row range from a specified table. The request can specify whether to delete all rows in a table, or only those that match a particular prefix. Note that row key prefixes used here are treated as service data. For more information about how service data is handled, see the Google Cloud Privacy Notice.
generate_consistency_tokenexecprojectsId, instancesId, tablesIdGenerates a consistency token for a Table, which can be used in CheckConsistency to check whether mutations to the table that finished before this call started have been replicated. The tokens will be available for 90 days.
check_consistencyexecprojectsId, instancesId, tablesIdChecks replication consistency based on a consistency token, that is, if replication has caught up based on the conditions specified in the token and the check request.
restoreexecprojectsId, instancesIdCreate a new table by restoring from a completed backup. The returned table long-running operation can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreTableMetadata. The response type is Table, if successful.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
instancesIdstring
projectsIdstring
tablesIdstring
ignoreWarningsboolean
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)
viewstring

SELECT examples

Gets metadata information about the specified table.

SELECT
name,
automatedBackupPolicy,
changeStreamConfig,
clusterStates,
columnFamilies,
deletionProtection,
granularity,
restoreInfo,
rowKeySchema,
stats,
tieredStorageConfig
FROM google.bigtableadmin.tables
WHERE projectsId = '{{ projectsId }}' -- required
AND instancesId = '{{ instancesId }}' -- required
AND tablesId = '{{ tablesId }}' -- required
AND view = '{{ view }}';

INSERT examples

Creates a new table in the specified instance. The table can be created with a full set of initial column families, specified in the request.

INSERT INTO google.bigtableadmin.tables (
data__tableId,
data__table,
data__initialSplits,
projectsId,
instancesId
)
SELECT
'{{ tableId }}',
'{{ table }}',
'{{ initialSplits }}',
'{{ projectsId }}',
'{{ instancesId }}'
RETURNING
name,
automatedBackupPolicy,
changeStreamConfig,
clusterStates,
columnFamilies,
deletionProtection,
granularity,
restoreInfo,
rowKeySchema,
stats,
tieredStorageConfig
;

UPDATE examples

Updates a specified table.

UPDATE google.bigtableadmin.tables
SET
data__name = '{{ name }}',
data__columnFamilies = '{{ columnFamilies }}',
data__granularity = '{{ granularity }}',
data__changeStreamConfig = '{{ changeStreamConfig }}',
data__deletionProtection = {{ deletionProtection }},
data__automatedBackupPolicy = '{{ automatedBackupPolicy }}',
data__tieredStorageConfig = '{{ tieredStorageConfig }}',
data__rowKeySchema = '{{ rowKeySchema }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND tablesId = '{{ tablesId }}' --required
AND updateMask = '{{ updateMask}}'
AND ignoreWarnings = {{ ignoreWarnings}}
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Permanently deletes a specified table and all of its data.

DELETE FROM google.bigtableadmin.tables
WHERE projectsId = '{{ projectsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND tablesId = '{{ tablesId }}' --required;

Lifecycle Methods

Restores a specified table which was accidentally deleted.

EXEC google.bigtableadmin.tables.undelete 
@projectsId='{{ projectsId }}' --required,
@instancesId='{{ instancesId }}' --required,
@tablesId='{{ tablesId }}' --required;