Skip to content

Commit

Permalink
feat!: Consolidate task details into service API and add orchestratio…
Browse files Browse the repository at this point in the history
…n result details

BREAKING CHANGE: This change relocates some task proto definitions and updates message fields, necessitating updates to imports.

PiperOrigin-RevId: 423360094
  • Loading branch information
Google APIs authored and copybara-github committed Jan 21, 2022
1 parent ada32e9 commit c9a482e
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 102 deletions.

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions google/cloud/bigquery/migration/v2alpha/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
proto_library(
name = "migration_proto",
srcs = [
"assessment_task.proto",
"migration_entities.proto",
"migration_error_details.proto",
"migration_metrics.proto",
"migration_service.proto",
"translation_task.proto",
],
deps = [
"//google/api:annotations_proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,36 @@

syntax = "proto3";

package google.cloud.bigquery.migration.tasks.assessment.v2alpha;
package google.cloud.bigquery.migration.v2alpha;

import "google/api/field_behavior.proto";

option csharp_namespace = "Google.Cloud.BigQuery.Migration.Tasks.Assessment.V2Alpha";
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha;assessment";
option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2Alpha";
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha;migration";
option java_multiple_files = true;
option java_outer_classname = "AssessmentProto";
option java_package = "com.google.cloud.bigquery.migration.tasks.assessment.v2alpha";
option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\Tasks\\Assessment\\V2alpha";
option java_outer_classname = "AssessmentTaskProto";
option java_package = "com.google.cloud.bigquery.migration.v2alpha";
option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2alpha";

// Assessment task details.
// Assessment task config.
message AssessmentTaskDetails {
// Required. The Cloud Storage path for assessment input files.
string input_path = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The BigQuery dataset for output.
string output_dataset = 2 [(google.api.field_behavior) = REQUIRED];

// Optional. An optional Cloud Storage path to write the query logs (which is then used
// as an input path on the translation task)
// Optional. An optional Cloud Storage path to write the query logs (which is
// then used as an input path on the translation task)
string querylogs_path = 3 [(google.api.field_behavior) = OPTIONAL];

// Required. The data source or data warehouse type (eg: TERADATA/REDSHIFT) from which
// the input data is extracted.
// Required. The data source or data warehouse type (eg: TERADATA/REDSHIFT)
// from which the input data is extracted.
string data_source = 4 [(google.api.field_behavior) = REQUIRED];
}

// Details for an assessment task orchestration result.
message AssessmentOrchestrationResultDetails {
// Optional. The version used for the output table schemas.
string output_tables_schema_version = 1 [(google.api.field_behavior) = OPTIONAL];
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@ title: BigQuery Migration API

apis:
- name: google.cloud.bigquery.migration.v2alpha.MigrationService
- name: google.cloud.bigquery.migration.v2alpha.SqlTranslationService

documentation:
summary: |-
The BigQuery migration service, exposing apis for migration jobs operations, and
The migration service, exposing apis for migration jobs operations, and
agent management.
backend:
rules:
- selector: 'google.cloud.bigquery.migration.v2alpha.MigrationService.*'
deadline: 60.0
- selector: google.cloud.bigquery.migration.v2alpha.SqlTranslationService.TranslateQuery
deadline: 60.0

authentication:
rules:
- selector: 'google.cloud.bigquery.migration.v2alpha.MigrationService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: google.cloud.bigquery.migration.v2alpha.SqlTranslationService.TranslateQuery
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
25 changes: 25 additions & 0 deletions google/cloud/bigquery/migration/v2alpha/migration_entities.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ package google.cloud.bigquery.migration.v2alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/bigquery/migration/v2alpha/assessment_task.proto";
import "google/cloud/bigquery/migration/v2alpha/migration_error_details.proto";
import "google/cloud/bigquery/migration/v2alpha/migration_metrics.proto";
import "google/cloud/bigquery/migration/v2alpha/translation_task.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
import "google/rpc/error_details.proto";
Expand Down Expand Up @@ -117,6 +119,15 @@ message MigrationTask {
FAILED = 6;
}

// The details of the task.
oneof task_details {
// Task configuration for Assessment.
AssessmentTaskDetails assessment_task_details = 12;

// Task configuration for Batch/Offline SQL Translation.
TranslationTaskDetails translation_task_details = 13;
}

// Output only. Immutable. The unique identifier for the migration task. The ID is server-generated.
string id = 1 [
(google.api.field_behavior) = OUTPUT_ONLY,
Expand All @@ -126,6 +137,7 @@ message MigrationTask {
// The type of the task. This must be a supported task type.
string type = 2;

// DEPRECATED! Use one of the task_details below.
// The details of the task. The type URL must be one of the supported task
// details messages and correspond to the Task's type.
google.protobuf.Any details = 3;
Expand All @@ -141,6 +153,9 @@ message MigrationTask {

// Time when the task was last updated.
google.protobuf.Timestamp last_update_time = 7;

// Output only. Additional information about the orchestration.
MigrationTaskOrchestrationResult orchestration_result = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// A subtask for a migration which carries details about the configuration of
Expand Down Expand Up @@ -217,3 +232,13 @@ message MigrationSubtask {
// The metrics for the subtask.
repeated TimeSeries metrics = 11;
}

// Additional information from the orchestrator when it is done with the
// task orchestration.
message MigrationTaskOrchestrationResult {
// Details specific to the task type.
oneof details {
// Details specific to assessment task types.
AssessmentOrchestrationResultDetails assessment_details = 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ message TranslateQueryRequest {
TERADATA = 1;
}

// Required. Project ID of the project that will be charged for the quota.
// Required. The name of the project to which this translation request belongs.
// Example: `projects/foo/locations/bar`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand All @@ -71,6 +72,13 @@ message TranslateQueryRequest {

// The response of translating a SQL query to Standard SQL.
message TranslateQueryResponse {
// Output only. Immutable. The unique identifier for the SQL translation job.
// Example: `projects/123/locations/us/translation/1234`
string translation_job = 4 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.field_behavior) = IMMUTABLE
];

// The translated result. This will be empty if the translation fails.
string translated_query = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@

syntax = "proto3";

package google.cloud.bigquery.migration.tasks.translation.v2alpha;
package google.cloud.bigquery.migration.v2alpha;

import "google/cloud/bigquery/migration/tasks/translation/v2alpha/dataset_reference.proto";

option csharp_namespace = "Google.Cloud.BigQuery.Migration.Tasks.Translation.V2Alpha";
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha;translation";
option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2Alpha";
option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha;migration";
option java_multiple_files = true;
option java_outer_classname = "TranslationProto";
option java_package = "com.google.cloud.bigquery.migration.tasks.translation.v2alpha";
option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\Tasks\\Translation\\V2alpha";
option java_outer_classname = "TranslationTaskProto";
option java_package = "com.google.cloud.bigquery.migration.v2alpha";
option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2alpha";

// Mapping between an input and output file to be translated in a subtask.
message TranslationFileMapping {
Expand All @@ -34,7 +32,7 @@ message TranslationFileMapping {
string output_path = 2;
}

// The translation task details to capture necessary settings for a translation
// The translation task config to capture necessary settings for a translation
// task and subtask.
message TranslationTaskDetails {
// The file encoding types.
Expand Down Expand Up @@ -88,6 +86,15 @@ message TranslationTaskDetails {
TIMESTAMP = 7;
}

// The language specific settings for the translation task.
oneof language_options {
// The Teradata SQL specific settings for the translation task.
TeradataOptions teradata_options = 10;

// The BTEQ specific settings for the translation task.
BteqOptions bteq_options = 11;
}

// The Cloud Storage path for translation input files.
string input_path = 1;

Expand Down Expand Up @@ -118,15 +125,6 @@ message TranslationTaskDetails {
// The filter applied to translation details.
Filter filter = 7;

// The language specific settings for the translation task.
oneof language_options {
// The Teradata SQL specific settings for the translation task.
TeradataOptions teradata_options = 10;

// The BTEQ specific settings for the translation task.
BteqOptions bteq_options = 11;
}

// Specifies the exact name of the bigquery table ("dataset.table") to be used
// for surfacing raw translation errors. If the table does not exist, we will
// create it. If it already exists and the schema is the same, we will re-use.
Expand Down Expand Up @@ -196,3 +194,14 @@ message BteqOptions {
// value).
map<string, string> file_replacement_map = 3;
}

// Reference to a BigQuery dataset.
message DatasetReference {
// A unique ID for this dataset, without the project name. The ID
// must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_).
// The maximum length is 1,024 characters.
string dataset_id = 1;

// The ID of the project containing this dataset.
string project_id = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,21 @@
}
],
"timeout": "60s"
},
{
"name": [
{
"service": "google.cloud.bigquery.migration.v2alpha.SqlTranslationService",
"method": "Translate"
}
],
"timeout": "30s",
"retryPolicy": {
"maxAttempts": 3,
"initialBackoff": "0.100s",
"maxBackoff": "1s",
"backoffMultiplier": 1.3,
"retryableStatusCodes": ["UNAVAILABLE"]
}
}]
}

0 comments on commit c9a482e

Please sign in to comment.