TabularApiSurface

TabularApiSurface

The TabularApiSurface class is a class that contains methods we want to expose on both tables and authorized views. It also contains data that will be used by both Authorized views and Tables for these shared methods.

Constructor

new TabularApiSurface(instance, id)

Parameters:
Name Type Description
instance Instance

Instance Object.

id string

Unique identifier of the table.

Methods

createReadStream(opts) → {stream}

Get Row objects for the rows currently in your table as a readable object stream.

Parameters:
Name Type Attributes Default Description
options.decode boolean <optional>
true

If set to false it will not decode Buffer values returned from Bigtable.

options.encoding boolean <optional>

The encoding to use when converting Buffer values to a string.

options.end string <optional>

End value for key range.

options.filter Filter <optional>

Row filters allow you to both make advanced queries and format how the data is returned.

options.gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

options.keys Array.<string> <optional>

A list of row keys.

options.limit number <optional>

Maximum number of rows to be returned.

options.prefix string <optional>

Prefix that the row key must match.

options.prefixes Array.<string> <optional>

List of prefixes that a row key must match.

options.ranges Array.<object> <optional>

A list of key ranges.

options.start string <optional>

Start value for key range.

opts
Returns:
Type Description
stream
Example

include:samples/api-reference-doc-snippets/table.js

region_tag:bigtable_api_table_readstream

getRows(optionsOrCallback, cb)

Get Row objects for the rows currently in your table.

This method is not recommended for large datasets as it will buffer all rows before returning the results. Instead we recommend using the streaming API via Table#createReadStream.

Table#createReadStream for a complete list of options.
Parameters:
Name Type Attributes Description
options.gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback.err error <nullable>

An error returned while making this request.

callback.rows Array.<Row>

List of Row objects.

optionsOrCallback
cb
Example

include:samples/api-reference-doc-snippets/table.js

region_tag:bigtable_api_get_rows

insert(entries, gaxOptionsopt, callback)

Insert or update rows in your table. It should be noted that gRPC only allows you to send payloads that are less than or equal to 4MB. If you're inserting more than that you may need to send smaller individual requests.

Parameters:
Name Type Attributes Description
entries object | Array.<object>

List of entries to be inserted. See Table#mutate.

gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

Properties
Name Type Description
errors Array.<object>

If present, these represent partial failures. It's possible for part of your request to be completed successfully, while the other part was not.

Example

include:samples/api-reference-doc-snippets/table.js

region_tag:bigtable_api_insert_rows

mutate(entries, optionsopt, callback)

Apply a set of changes to be atomically applied to the specified row(s). Mutations are applied in order, meaning that earlier mutations can be masked by later ones.

Parameters:
Name Type Attributes Description
entries object | Array.<object>

List of entities to be inserted or deleted.

options object <optional>

Configuration object.

Properties
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.

rawMutation boolean <optional>

If set to true will treat entries as a raw Mutation object. See Mutation#parse.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

Properties
Name Type Description
errors Array.<object>

If present, these represent partial failures. It's possible for part of your request to be completed successfully, while the other part was not.

Example

include:samples/api-reference-doc-snippets/table.js

region_tag:bigtable_api_mutate_rows

row(key) → {Row}

Get a reference to a table row.

Parameters:
Name Type Description
key string

The row key.

Returns:
Type Description
Row
Throws:

If a key is not provided.

Type
error
Example
```
const row = table.row('lincoln');
```

sampleRowKeys(gaxOptionsopt, callbackopt)

Returns a sample of row keys in the table. The returned row keys will delimit contiguous sections of the table of approximately equal size, which can be used to break up the data for distributed tasks like mapreduces.

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
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

keys Array.<object>

The list of keys.

Example

include:samples/api-reference-doc-snippets/table.js

region_tag:bigtable_api_sample_row_keys

sampleRowKeysStream(gaxOptionsopt) → {stream}

Returns a sample of row keys in the table as a readable object stream.

See Table#sampleRowKeys for more details.

Parameters:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

Returns:
Type Description
stream
Example
```
table.sampleRowKeysStream()
  .on('error', console.error)
  .on('data', function(key) {
    // Do something with the `key` object.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing.
//-
table.sampleRowKeysStream()
  .on('data', function(key) {
    this.end();
  });
```