1// Copyright 2021 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.bigquery.migration.v2alpha; 18 19option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2Alpha"; 20option go_package = "cloud.google.com/go/bigquery/migration/apiv2alpha/migrationpb;migrationpb"; 21option java_multiple_files = true; 22option java_outer_classname = "TranslationTaskProto"; 23option java_package = "com.google.cloud.bigquery.migration.v2alpha"; 24option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2alpha"; 25 26// Mapping between an input and output file to be translated in a subtask. 27message TranslationFileMapping { 28 // The Cloud Storage path for a file to translation in a subtask. 29 string input_path = 1; 30 31 // The Cloud Storage path to write back the corresponding input file to. 32 string output_path = 2; 33} 34 35// The translation task config to capture necessary settings for a translation 36// task and subtask. 37message TranslationTaskDetails { 38 // The file encoding types. 39 enum FileEncoding { 40 // File encoding setting is not specified. 41 FILE_ENCODING_UNSPECIFIED = 0; 42 43 // File encoding is UTF_8. 44 UTF_8 = 1; 45 46 // File encoding is ISO_8859_1. 47 ISO_8859_1 = 2; 48 49 // File encoding is US_ASCII. 50 US_ASCII = 3; 51 52 // File encoding is UTF_16. 53 UTF_16 = 4; 54 55 // File encoding is UTF_16LE. 56 UTF_16LE = 5; 57 58 // File encoding is UTF_16BE. 59 UTF_16BE = 6; 60 } 61 62 // The special token data type. 63 enum TokenType { 64 // Token type is not specified. 65 TOKEN_TYPE_UNSPECIFIED = 0; 66 67 // Token type as string. 68 STRING = 1; 69 70 // Token type as integer. 71 INT64 = 2; 72 73 // Token type as numeric. 74 NUMERIC = 3; 75 76 // Token type as boolean. 77 BOOL = 4; 78 79 // Token type as float. 80 FLOAT64 = 5; 81 82 // Token type as date. 83 DATE = 6; 84 85 // Token type as timestamp. 86 TIMESTAMP = 7; 87 } 88 89 // The language specific settings for the translation task. 90 oneof language_options { 91 // The Teradata SQL specific settings for the translation task. 92 TeradataOptions teradata_options = 10; 93 94 // The BTEQ specific settings for the translation task. 95 BteqOptions bteq_options = 11; 96 } 97 98 // The Cloud Storage path for translation input files. 99 string input_path = 1; 100 101 // The Cloud Storage path for translation output files. 102 string output_path = 2; 103 104 // Cloud Storage files to be processed for translation. 105 repeated TranslationFileMapping file_paths = 12; 106 107 // The Cloud Storage path to DDL files as table schema to assist semantic 108 // translation. 109 string schema_path = 3; 110 111 // The file encoding type. 112 FileEncoding file_encoding = 4; 113 114 // The settings for SQL identifiers. 115 IdentifierSettings identifier_settings = 5; 116 117 // The map capturing special tokens to be replaced during translation. The key 118 // is special token in string. The value is the token data type. This is used 119 // to translate SQL query template which contains special token as place 120 // holder. The special token makes a query invalid to parse. This map will be 121 // applied to annotate those special token with types to let parser understand 122 // how to parse them into proper structure with type information. 123 map<string, TokenType> special_token_map = 6; 124 125 // The filter applied to translation details. 126 Filter filter = 7; 127 128 // Specifies the exact name of the bigquery table ("dataset.table") to be used 129 // for surfacing raw translation errors. If the table does not exist, we will 130 // create it. If it already exists and the schema is the same, we will re-use. 131 // If the table exists and the schema is different, we will throw an error. 132 string translation_exception_table = 13; 133} 134 135// The filter applied to fields of translation details. 136message Filter { 137 // The list of prefixes used to exclude processing for input files. 138 repeated string input_file_exclusion_prefixes = 1; 139} 140 141// Settings related to SQL identifiers. 142message IdentifierSettings { 143 // The identifier case type. 144 enum IdentifierCase { 145 // The identifier case is not specified. 146 IDENTIFIER_CASE_UNSPECIFIED = 0; 147 148 // Identifiers' cases will be kept as the original cases. 149 ORIGINAL = 1; 150 151 // Identifiers will be in upper cases. 152 UPPER = 2; 153 154 // Identifiers will be in lower cases. 155 LOWER = 3; 156 } 157 158 // The SQL identifier rewrite mode. 159 enum IdentifierRewriteMode { 160 // SQL Identifier rewrite mode is unspecified. 161 IDENTIFIER_REWRITE_MODE_UNSPECIFIED = 0; 162 163 // SQL identifiers won't be rewrite. 164 NONE = 1; 165 166 // All SQL identifiers will be rewrite. 167 REWRITE_ALL = 2; 168 } 169 170 // The setting to control output queries' identifier case. 171 IdentifierCase output_identifier_case = 1; 172 173 // Specifies the rewrite mode for SQL identifiers. 174 IdentifierRewriteMode identifier_rewrite_mode = 2; 175} 176 177// Teradata SQL specific translation task related settings. 178message TeradataOptions { 179 180} 181 182// BTEQ translation task related settings. 183message BteqOptions { 184 // Specifies the project and dataset in BigQuery that will be used for 185 // external table creation during the translation. 186 DatasetReference project_dataset = 1; 187 188 // The Cloud Storage location to be used as the default path for files that 189 // are not otherwise specified in the file replacement map. 190 string default_path_uri = 2; 191 192 // Maps the local paths that are used in BTEQ scripts (the keys) to the paths 193 // in Cloud Storage that should be used in their stead in the translation (the 194 // value). 195 map<string, string> file_replacement_map = 3; 196} 197 198// Reference to a BigQuery dataset. 199message DatasetReference { 200 // A unique ID for this dataset, without the project name. The ID 201 // must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). 202 // The maximum length is 1,024 characters. 203 string dataset_id = 1; 204 205 // The ID of the project containing this dataset. 206 string project_id = 2; 207} 208