Class v2alpha.SqlTranslationServiceClient (1.0.1)

Provides other SQL dialects to GoogleSQL translation operations. v2alpha

Package

@google-cloud/bigquery-migration

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of SqlTranslationServiceClient.

Parameters
NameDescription
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 SqlTranslationServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [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.

sqlTranslationServiceStub

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

warn

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

Methods

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
TypeDescription
Promise<void>

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

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

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

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromMigrationSubtaskName(migrationSubtaskName)

matchLocationFromMigrationSubtaskName(migrationSubtaskName: string): string | number;

Parse the location from MigrationSubtask resource.

Parameter
NameDescription
migrationSubtaskName string

A fully-qualified path representing MigrationSubtask resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromMigrationWorkflowName(migrationWorkflowName)

matchLocationFromMigrationWorkflowName(migrationWorkflowName: string): string | number;

Parse the location from MigrationWorkflow resource.

Parameter
NameDescription
migrationWorkflowName string

A fully-qualified path representing MigrationWorkflow resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromMigrationSubtaskName(migrationSubtaskName)

matchProjectFromMigrationSubtaskName(migrationSubtaskName: string): string | number;

Parse the project from MigrationSubtask resource.

Parameter
NameDescription
migrationSubtaskName string

A fully-qualified path representing MigrationSubtask resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromMigrationWorkflowName(migrationWorkflowName)

matchProjectFromMigrationWorkflowName(migrationWorkflowName: string): string | number;

Parse the project from MigrationWorkflow resource.

Parameter
NameDescription
migrationWorkflowName string

A fully-qualified path representing MigrationWorkflow resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchSubtaskFromMigrationSubtaskName(migrationSubtaskName)

matchSubtaskFromMigrationSubtaskName(migrationSubtaskName: string): string | number;

Parse the subtask from MigrationSubtask resource.

Parameter
NameDescription
migrationSubtaskName string

A fully-qualified path representing MigrationSubtask resource.

Returns
TypeDescription
string | number

{string} A string representing the subtask.

matchWorkflowFromMigrationSubtaskName(migrationSubtaskName)

matchWorkflowFromMigrationSubtaskName(migrationSubtaskName: string): string | number;

Parse the workflow from MigrationSubtask resource.

Parameter
NameDescription
migrationSubtaskName string

A fully-qualified path representing MigrationSubtask resource.

Returns
TypeDescription
string | number

{string} A string representing the workflow.

matchWorkflowFromMigrationWorkflowName(migrationWorkflowName)

matchWorkflowFromMigrationWorkflowName(migrationWorkflowName: string): string | number;

Parse the workflow from MigrationWorkflow resource.

Parameter
NameDescription
migrationWorkflowName string

A fully-qualified path representing MigrationWorkflow resource.

Returns
TypeDescription
string | number

{string} A string representing the workflow.

migrationSubtaskPath(project, location, workflow, subtask)

migrationSubtaskPath(project: string, location: string, workflow: string, subtask: string): string;

Return a fully-qualified migrationSubtask resource name string.

Parameters
NameDescription
project string
location string
workflow string
subtask string
Returns
TypeDescription
string

{string} Resource name string.

migrationWorkflowPath(project, location, workflow)

migrationWorkflowPath(project: string, location: string, workflow: string): string;

Return a fully-qualified migrationWorkflow resource name string.

Parameters
NameDescription
project string
location string
workflow string
Returns
TypeDescription
string

{string} Resource name string.

translateQuery(request, options)

translateQuery(request?: protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse,
        (protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | undefined),
        {} | undefined
    ]>;

Translates input queries from source dialects to GoogleSQL.

Parameters
NameDescription
request ITranslateQueryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, (protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing TranslateQueryResponse. 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. The name of the project to which this translation request belongs.
   *  Example: `projects/foo/locations/bar`
   */
  // const parent = 'abc123'
  /**
   *  Required. The source SQL dialect of `queries`.
   */
  // const sourceDialect = {}
  /**
   *  Required. The query to be translated.
   */
  // const query = 'abc123'

  // Imports the Migration library
  const {SqlTranslationServiceClient} = require('@google-cloud/bigquery-migration').v2alpha;

  // Instantiates a client
  const migrationClient = new SqlTranslationServiceClient();

  async function callTranslateQuery() {
    // Construct request
    const request = {
      parent,
      sourceDialect,
      query,
    };

    // Run request
    const response = await migrationClient.translateQuery(request);
    console.log(response);
  }

  callTranslateQuery();

translateQuery(request, options, callback)

translateQuery(request: protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest, options: CallOptions, callback: Callback<protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ITranslateQueryRequest
options CallOptions
callback Callback<protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

translateQuery(request, callback)

translateQuery(request: protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest, callback: Callback<protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ITranslateQueryRequest
callback Callback<protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void