Class v1alpha.MetastorePartitionServiceClient (4.10.0)

BigQuery Metastore Partition Service API. This service is used for managing metastore partitions in BigQuery metastore. The service supports only batch operations for write. v1alpha

Package

@google-cloud/bigquery-storage

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of MetastorePartitionServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new MetastorePartitionServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

metastorePartitionServiceStub

metastorePartitionServiceStub?: Promise<{
        [name: string]: Function;
    }>;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

batchCreateMetastorePartitions(request, options)

batchCreateMetastorePartitions(request?: protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse,
        (protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | undefined),
        {} | undefined
    ]>;

Adds metastore partitions to a table.

Parameters
Name Description
request IBatchCreateMetastorePartitionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse, (protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchCreateMetastorePartitionsResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Reference to the table to where the metastore partitions to be
   *  added, in the format of
   *  projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
   */
  // const parent = 'abc123'
  /**
   *  Required. Requests to add metastore partitions to the table.
   */
  // const requests = [1,2,3,4]
  /**
   *  Optional. Mimics the ifNotExists flag in IMetaStoreClient
   *  add_partitions(..). If the flag is set to false, the server will return
   *  ALREADY_EXISTS if any partition already exists. If the flag is set to true,
   *  the server will skip existing partitions and insert only the non-existing
   *  partitions.
   */
  // const skipExistingPartitions = true

  // Imports the Storage library
  const {MetastorePartitionServiceClient} = require('@google-cloud/storage').v1alpha;

  // Instantiates a client
  const storageClient = new MetastorePartitionServiceClient();

  async function callBatchCreateMetastorePartitions() {
    // Construct request
    const request = {
      parent,
      requests,
    };

    // Run request
    const response = await storageClient.batchCreateMetastorePartitions(request);
    console.log(response);
  }

  callBatchCreateMetastorePartitions();

batchCreateMetastorePartitions(request, options, callback)

batchCreateMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchCreateMetastorePartitionsRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchCreateMetastorePartitions(request, callback)

batchCreateMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchCreateMetastorePartitionsRequest
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchCreateMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchDeleteMetastorePartitions(request, options)

batchDeleteMetastorePartitions(request?: protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | undefined),
        {} | undefined
    ]>;

Deletes metastore partitions from a table.

Parameters
Name Description
request IBatchDeleteMetastorePartitionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Reference to the table to which these metastore partitions
   *  belong, in the format of
   *  projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
   */
  // const parent = 'abc123'
  /**
   *  Required. The list of metastore partitions (identified by its values) to be
   *  deleted. A maximum of 100 partitions can be deleted in a batch.
   */
  // const partitionValues = [1,2,3,4]

  // Imports the Storage library
  const {MetastorePartitionServiceClient} = require('@google-cloud/storage').v1alpha;

  // Instantiates a client
  const storageClient = new MetastorePartitionServiceClient();

  async function callBatchDeleteMetastorePartitions() {
    // Construct request
    const request = {
      parent,
      partitionValues,
    };

    // Run request
    const response = await storageClient.batchDeleteMetastorePartitions(request);
    console.log(response);
  }

  callBatchDeleteMetastorePartitions();

batchDeleteMetastorePartitions(request, options, callback)

batchDeleteMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchDeleteMetastorePartitionsRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchDeleteMetastorePartitions(request, callback)

batchDeleteMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchDeleteMetastorePartitionsRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.cloud.bigquery.storage.v1alpha.IBatchDeleteMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchUpdateMetastorePartitions(request, options)

batchUpdateMetastorePartitions(request?: protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse,
        (protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | undefined),
        {} | undefined
    ]>;

Updates metastore partitions in a table.

Parameters
Name Description
request IBatchUpdateMetastorePartitionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse, (protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing BatchUpdateMetastorePartitionsResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Reference to the table to which these metastore partitions
   *  belong, in the format of
   *  projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
   */
  // const parent = 'abc123'
  /**
   *  Required. Requests to update metastore partitions in the table.
   */
  // const requests = [1,2,3,4]

  // Imports the Storage library
  const {MetastorePartitionServiceClient} = require('@google-cloud/storage').v1alpha;

  // Instantiates a client
  const storageClient = new MetastorePartitionServiceClient();

  async function callBatchUpdateMetastorePartitions() {
    // Construct request
    const request = {
      parent,
      requests,
    };

    // Run request
    const response = await storageClient.batchUpdateMetastorePartitions(request);
    console.log(response);
  }

  callBatchUpdateMetastorePartitions();

batchUpdateMetastorePartitions(request, options, callback)

batchUpdateMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchUpdateMetastorePartitionsRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

batchUpdateMetastorePartitions(request, callback)

batchUpdateMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IBatchUpdateMetastorePartitionsRequest
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IBatchUpdateMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
Type Description
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
Type Description
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listMetastorePartitions(request, options)

listMetastorePartitions(request?: protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse,
        (protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | undefined),
        {} | undefined
    ]>;

Gets metastore partitions from a table.

Parameters
Name Description
request IListMetastorePartitionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse, (protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ListMetastorePartitionsResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Reference to the table to which these metastore partitions
   *  belong, in the format of
   *  projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
   */
  // const parent = 'abc123'
  /**
   *  Optional. SQL text filtering statement, similar to a WHERE clause in a
   *  query. Only supports single-row expressions.  Aggregate functions are not
   *  supported.
   *  Examples: "int_field > 5"
   *            "date_field = CAST('2014-9-27' as DATE)"
   *            "nullable_field is not NULL"
   *            "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))"
   *            "numeric_field BETWEEN 1.0 AND 5.0"
   *  Restricted to a maximum length for 1 MB.
   */
  // const filter = 'abc123'

  // Imports the Storage library
  const {MetastorePartitionServiceClient} = require('@google-cloud/storage').v1alpha;

  // Instantiates a client
  const storageClient = new MetastorePartitionServiceClient();

  async function callListMetastorePartitions() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const response = await storageClient.listMetastorePartitions(request);
    console.log(response);
  }

  callListMetastorePartitions();

listMetastorePartitions(request, options, callback)

listMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IListMetastorePartitionsRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

listMetastorePartitions(request, callback)

listMetastorePartitions(request: protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest, callback: Callback<protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IListMetastorePartitionsRequest
callback Callback<protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsResponse, protos.google.cloud.bigquery.storage.v1alpha.IListMetastorePartitionsRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

matchDatasetFromTableName(tableName)

matchDatasetFromTableName(tableName: string): string | number;

Parse the dataset from Table resource.

Parameter
Name Description
tableName string

A fully-qualified path representing Table resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchLocationFromReadStreamName(readStreamName)

matchLocationFromReadStreamName(readStreamName: string): string | number;

Parse the location from ReadStream resource.

Parameter
Name Description
readStreamName string

A fully-qualified path representing ReadStream resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchProjectFromReadStreamName(readStreamName)

matchProjectFromReadStreamName(readStreamName: string): string | number;

Parse the project from ReadStream resource.

Parameter
Name Description
readStreamName string

A fully-qualified path representing ReadStream resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromTableName(tableName)

matchProjectFromTableName(tableName: string): string | number;

Parse the project from Table resource.

Parameter
Name Description
tableName string

A fully-qualified path representing Table resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchSessionFromReadStreamName(readStreamName)

matchSessionFromReadStreamName(readStreamName: string): string | number;

Parse the session from ReadStream resource.

Parameter
Name Description
readStreamName string

A fully-qualified path representing ReadStream resource.

Returns
Type Description
string | number

{string} A string representing the session.

matchStreamFromReadStreamName(readStreamName)

matchStreamFromReadStreamName(readStreamName: string): string | number;

Parse the stream from ReadStream resource.

Parameter
Name Description
readStreamName string

A fully-qualified path representing ReadStream resource.

Returns
Type Description
string | number

{string} A string representing the stream.

matchTableFromTableName(tableName)

matchTableFromTableName(tableName: string): string | number;

Parse the table from Table resource.

Parameter
Name Description
tableName string

A fully-qualified path representing Table resource.

Returns
Type Description
string | number

{string} A string representing the table.

readStreamPath(project, location, session, stream)

readStreamPath(project: string, location: string, session: string, stream: string): string;

Return a fully-qualified readStream resource name string.

Parameters
Name Description
project string
location string
session string
stream string
Returns
Type Description
string

{string} Resource name string.

streamMetastorePartitions(options)

streamMetastorePartitions(options?: CallOptions): gax.CancellableStream;

This is a bi-di streaming rpc method that allows the client to send a stream of partitions and commit all of them atomically at the end. If the commit is successful, the server will return a response and close the stream. If the commit fails (due to duplicate partitions or other reason), the server will close the stream with an error. This method is only available via the gRPC API (not REST).

Parameter
Name Description
options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
gax.CancellableStream

{Stream} An object stream which is both readable and writable. It accepts objects representing StreamMetastorePartitionsRequest for write() method, and will emit objects representing StreamMetastorePartitionsResponse on 'data' event asynchronously. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. Reference to the table to where the partition to be added, in the
   *  format of
   *  projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
   */
  // const parent = 'abc123'
  /**
   *  Optional. A list of metastore partitions to be added to the table.
   */
  // const metastorePartitions = [1,2,3,4]
  /**
   *  Optional. Mimics the ifNotExists flag in IMetaStoreClient
   *  add_partitions(..). If the flag is set to false, the server will return
   *  ALREADY_EXISTS on commit if any partition already exists. If the flag is
   *  set to true:
   *   1) the server will skip existing partitions
   *   insert only the non-existing partitions as part of the commit.
   *   2) The client must set the `skip_existing_partitions` field to true for
   *   all requests in the stream.
   */
  // const skipExistingPartitions = true

  // Imports the Storage library
  const {MetastorePartitionServiceClient} = require('@google-cloud/storage').v1alpha;

  // Instantiates a client
  const storageClient = new MetastorePartitionServiceClient();

  async function callStreamMetastorePartitions() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const stream = await storageClient.streamMetastorePartitions();
    stream.on('data', (response) => { console.log(response) });
    stream.on('error', (err) => { throw(err) });
    stream.on('end', () => { /* API call completed */ });
    stream.write(request);
    stream.end();
  }

  callStreamMetastorePartitions();

tablePath(project, dataset, table)

tablePath(project: string, dataset: string, table: string): string;

Return a fully-qualified table resource name string.

Parameters
Name Description
project string
dataset string
table string
Returns
Type Description
string

{string} Resource name string.