Constructor
new Table(instance, id)
Parameters:
| Name | Type | Description |
|---|---|---|
instance |
Instance |
Instance Object. |
id |
string |
Unique identifier of the table. |
Methods
checkConsistency(token, callback)
Checks consistency for given ConsistencyToken
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
token |
string |
consistency token |
||||||||||||
callback |
function |
The callback function. Properties
|
create(optionsopt, callback)
Create a table.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
See Instance#createTable. Properties
|
||||||||||||||||
callback |
function |
The callback function. Properties
|
createBackup(id, config, callbackopt) → {void|Promise.<CreateBackupResponse>}
Backup a table with cluster auto selection.
Backups of tables originate from a specific cluster. This is a helper
around Cluster.createBackup that automatically selects the first ready
cluster from which a backup can be performed.
NOTE: This will make two API requests to first determine the most appropriate cluster, then create the backup. This could lead to a race condition if other requests are simultaneously sent or if the cluster availability state changes between each call.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string |
A unique ID for the backup. |
|||||||||||||||||||||
config |
CreateBackupConfig |
Metadata to set on the Backup. Properties
|
|||||||||||||||||||||
callback |
CreateBackupCallback |
<optional> |
The callback function. Properties
|
Returns:
| Type | Description |
|---|---|
| void | Promise.<CreateBackupResponse> |
createFamily(id, optionsopt, callback)
Create a column family.
Optionally you can send garbage collection rules and when creating a family. Garbage collection executes opportunistically in the background, so it's possible for reads to return a cell even if it matches the active expression for its family.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string |
The unique identifier of column family. |
|||||||||||||||||||||||||||||||||
options |
object |
<optional> |
Configuration object. Properties
|
||||||||||||||||||||||||||||||||
callback |
function |
The callback function. Properties
|
Throws:
-
If a name is not provided.
- Type
- error
delete(gaxOptionsopt, callbackopt)
Delete the table.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
deleteRows(prefix, gaxOptionsopt, callback)
Delete all rows in the table, optionally corresponding to a particular prefix.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
prefix |
string |
Row key prefix. |
|||||||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
Throws:
-
If a prefix is not provided.
- Type
- error
exists(gaxOptionsopt, callback)
Check if a table exists.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
family(id) → {Family}
Get a reference to a Table Family.
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string |
The family unique identifier. |
Returns:
| Type | Description |
|---|---|
| Family |
Throws:
-
If a name is not provided.
- Type
- error
generateConsistencyToken(callback)
Generates Consistency-Token
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
The callback function. Properties
|
get(optionsopt)
Get a table if it exists.
You may optionally use this to "get or create" an object by providing an
object with autoCreate set to true. Any extra configuration that is
normally required for the create method must be contained within this
object as well.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Configuration object. Properties
|
|||||||||||||||
callback.error |
error |
<nullable> |
An error returned while making this request. |
|||||||||||||||
callback.table |
Table |
The Table object. |
||||||||||||||||
callback.apiResponse |
object |
The resource as it exists in the API. |
getFamilies(gaxOptionsopt, callback)
Get Family objects for all the column families in your table.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
getIamPolicy(optionsopt, callbackopt, policy)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Configuration object. Properties
|
||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
||||||||||||
policy |
Policy |
The policy. |
Example
include:samples/api-reference-doc-snippets/instance.js
region_tag:bigtable_api_get_table_Iam_policy
getMetadata(optionsopt, callbackopt)
Get the table's metadata.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Table request options. Properties
|
||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
getReplicationStates(gaxOptionsopt, callback)
Get replication states of the clusters for this table.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
Example
```
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance('my-instance');
const table = instance.table('prezzy');
table.getReplicationStates(function(err, clusterStates, apiResponse) {
// `clusterStates` is an map of clusterId and its replication state.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
table.getReplicationStates().then(function(data) {
const clusterStates = data[0];
const apiResponse = data[1];
});
```
setIamPolicy(gaxOptionsopt, callbackopt, policy)
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||
callback |
function |
<optional> |
The callback function. Properties
|
||||||||
policy |
Policy |
The policy. |
Example
include:samples/api-reference-doc-snippets/instance.js
region_tag:bigtable_api_set_table_Iam_policy
testIamPermissions(permissions, gaxOptionsopt, callbackopt, permissions)
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
permissions |
string | Array.<string> |
The permission(s) to test for. |
|||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||
callback |
function |
<optional> |
The callback function. Properties
|
||||||||
permissions |
Array.<string> |
A subset of permissions that the caller is allowed. |
Example
include:samples/api-reference-doc-snippets/instance.js
region_tag:bigtable_api_test_table_Iam_permissions
truncate(gaxOptionsopt, callback)
Truncate the table.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
Example
```
table.truncate(function(err, apiResponse) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
table.truncate().then(function(data) {
const apiResponse = data[0];
});
```
waitForReplication(callback)
Generates Consistency-Token and check consistency for generated token In-case consistency check returns false, retrial is done in interval of 5 seconds till 10 minutes, after that it returns false.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
callback |
function |
The callback function. Properties
|