Provides other SQL dialects to GoogleSQL translation operations. v2alpha
Package
@google-cloud/bigquery-migrationConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of SqlTranslationServiceClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
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 | |
---|---|
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. |
locationPath(project, location)
locationPath(project: string, location: string): string;
Return a fully-qualified location resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
Returns | |
---|---|
Type | Description |
string | {string} Resource name string. |
matchLocationFromLocationName(locationName)
matchLocationFromLocationName(locationName: string): string | number;
Parse the location from Location resource.
Parameter | |
---|---|
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromMigrationSubtaskName(migrationSubtaskName)
matchLocationFromMigrationSubtaskName(migrationSubtaskName: string): string | number;
Parse the location from MigrationSubtask resource.
Parameter | |
---|---|
Name | Description |
migrationSubtaskName |
string
A fully-qualified path representing MigrationSubtask resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the location. |
matchLocationFromMigrationWorkflowName(migrationWorkflowName)
matchLocationFromMigrationWorkflowName(migrationWorkflowName: string): string | number;
Parse the location from MigrationWorkflow resource.
Parameter | |
---|---|
Name | Description |
migrationWorkflowName |
string
A fully-qualified path representing MigrationWorkflow resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the location. |
matchProjectFromLocationName(locationName)
matchProjectFromLocationName(locationName: string): string | number;
Parse the project from Location resource.
Parameter | |
---|---|
Name | Description |
locationName |
string
A fully-qualified path representing Location resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromMigrationSubtaskName(migrationSubtaskName)
matchProjectFromMigrationSubtaskName(migrationSubtaskName: string): string | number;
Parse the project from MigrationSubtask resource.
Parameter | |
---|---|
Name | Description |
migrationSubtaskName |
string
A fully-qualified path representing MigrationSubtask resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
matchProjectFromMigrationWorkflowName(migrationWorkflowName)
matchProjectFromMigrationWorkflowName(migrationWorkflowName: string): string | number;
Parse the project from MigrationWorkflow resource.
Parameter | |
---|---|
Name | Description |
migrationWorkflowName |
string
A fully-qualified path representing MigrationWorkflow resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the project. |
matchSubtaskFromMigrationSubtaskName(migrationSubtaskName)
matchSubtaskFromMigrationSubtaskName(migrationSubtaskName: string): string | number;
Parse the subtask from MigrationSubtask resource.
Parameter | |
---|---|
Name | Description |
migrationSubtaskName |
string
A fully-qualified path representing MigrationSubtask resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the subtask. |
matchWorkflowFromMigrationSubtaskName(migrationSubtaskName)
matchWorkflowFromMigrationSubtaskName(migrationSubtaskName: string): string | number;
Parse the workflow from MigrationSubtask resource.
Parameter | |
---|---|
Name | Description |
migrationSubtaskName |
string
A fully-qualified path representing MigrationSubtask resource. |
Returns | |
---|---|
Type | Description |
string | number | {string} A string representing the workflow. |
matchWorkflowFromMigrationWorkflowName(migrationWorkflowName)
matchWorkflowFromMigrationWorkflowName(migrationWorkflowName: string): string | number;
Parse the workflow from MigrationWorkflow resource.
Parameter | |
---|---|
Name | Description |
migrationWorkflowName |
string
A fully-qualified path representing MigrationWorkflow resource. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
project |
string
|
location |
string
|
workflow |
string
|
subtask |
string
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
project |
string
|
location |
string
|
workflow |
string
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request |
ITranslateQueryRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
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. |
/**
* 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 | |
---|---|
Name | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request |
ITranslateQueryRequest
|
callback |
Callback<protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryResponse, protos.google.cloud.bigquery.migration.v2alpha.ITranslateQueryRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |