xref: /aosp_15_r20/external/googleapis/google/cloud/bigquery/migration/v2/translation_config.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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.v2;
18
19option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2";
20option go_package = "cloud.google.com/go/bigquery/migration/apiv2/migrationpb;migrationpb";
21option java_multiple_files = true;
22option java_outer_classname = "TranslationConfigProto";
23option java_package = "com.google.cloud.bigquery.migration.v2";
24option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2";
25
26// The translation config to capture necessary settings for a translation task
27// and subtask.
28message TranslationConfigDetails {
29  // The chosen path where the source for input files will be found.
30  oneof source_location {
31    // The Cloud Storage path for a directory of files to translate in a task.
32    string gcs_source_path = 1;
33  }
34
35  // The chosen path where the destination for output files will be found.
36  oneof target_location {
37    // The Cloud Storage path to write back the corresponding input files to.
38    string gcs_target_path = 2;
39  }
40
41  // The mapping of full SQL object names from their current state to the
42  // desired output.
43  oneof output_name_mapping {
44    // The mapping of objects to their desired output names in list form.
45    ObjectNameMappingList name_mapping_list = 5;
46  }
47
48  // The dialect of the input files.
49  Dialect source_dialect = 3;
50
51  // The target dialect for the engine to translate the input to.
52  Dialect target_dialect = 4;
53
54  // The default source environment values for the translation.
55  SourceEnv source_env = 6;
56
57  // The indicator to show translation request initiator.
58  string request_source = 8;
59}
60
61// The possible dialect options for translation.
62message Dialect {
63  // The possible dialect options that this message represents.
64  oneof dialect_value {
65    // The BigQuery dialect
66    BigQueryDialect bigquery_dialect = 1;
67
68    // The HiveQL dialect
69    HiveQLDialect hiveql_dialect = 2;
70
71    // The Redshift dialect
72    RedshiftDialect redshift_dialect = 3;
73
74    // The Teradata dialect
75    TeradataDialect teradata_dialect = 4;
76
77    // The Oracle dialect
78    OracleDialect oracle_dialect = 5;
79
80    // The SparkSQL dialect
81    SparkSQLDialect sparksql_dialect = 6;
82
83    // The Snowflake dialect
84    SnowflakeDialect snowflake_dialect = 7;
85
86    // The Netezza dialect
87    NetezzaDialect netezza_dialect = 8;
88
89    // The Azure Synapse dialect
90    AzureSynapseDialect azure_synapse_dialect = 9;
91
92    // The Vertica dialect
93    VerticaDialect vertica_dialect = 10;
94
95    // The SQL Server dialect
96    SQLServerDialect sql_server_dialect = 11;
97
98    // The Postgresql dialect
99    PostgresqlDialect postgresql_dialect = 12;
100
101    // The Presto dialect
102    PrestoDialect presto_dialect = 13;
103
104    // The MySQL dialect
105    MySQLDialect mysql_dialect = 14;
106  }
107}
108
109// The dialect definition for BigQuery.
110message BigQueryDialect {}
111
112// The dialect definition for HiveQL.
113message HiveQLDialect {}
114
115// The dialect definition for Redshift.
116message RedshiftDialect {}
117
118// The dialect definition for Teradata.
119message TeradataDialect {
120  // The sub-dialect options for Teradata.
121  enum Mode {
122    // Unspecified mode.
123    MODE_UNSPECIFIED = 0;
124
125    // Teradata SQL mode.
126    SQL = 1;
127
128    // BTEQ mode (which includes SQL).
129    BTEQ = 2;
130  }
131
132  // Which Teradata sub-dialect mode the user specifies.
133  Mode mode = 1;
134}
135
136// The dialect definition for Oracle.
137message OracleDialect {}
138
139// The dialect definition for SparkSQL.
140message SparkSQLDialect {}
141
142// The dialect definition for Snowflake.
143message SnowflakeDialect {}
144
145// The dialect definition for Netezza.
146message NetezzaDialect {}
147
148// The dialect definition for Azure Synapse.
149message AzureSynapseDialect {}
150
151// The dialect definition for Vertica.
152message VerticaDialect {}
153
154// The dialect definition for SQL Server.
155message SQLServerDialect {}
156
157// The dialect definition for Postgresql.
158message PostgresqlDialect {}
159
160// The dialect definition for Presto.
161message PrestoDialect {}
162
163// The dialect definition for MySQL.
164message MySQLDialect {}
165
166// Represents a map of name mappings using a list of key:value proto messages of
167// existing name to desired output name.
168message ObjectNameMappingList {
169  // The elements of the object name map.
170  repeated ObjectNameMapping name_map = 1;
171}
172
173// Represents a key-value pair of NameMappingKey to NameMappingValue to
174// represent the mapping of SQL names from the input value to desired output.
175message ObjectNameMapping {
176  // The name of the object in source that is being mapped.
177  NameMappingKey source = 1;
178
179  // The desired target name of the object that is being mapped.
180  NameMappingValue target = 2;
181}
182
183// The potential components of a full name mapping that will be mapped
184// during translation in the source data warehouse.
185message NameMappingKey {
186  // The type of the object that is being mapped.
187  enum Type {
188    // Unspecified name mapping type.
189    TYPE_UNSPECIFIED = 0;
190
191    // The object being mapped is a database.
192    DATABASE = 1;
193
194    // The object being mapped is a schema.
195    SCHEMA = 2;
196
197    // The object being mapped is a relation.
198    RELATION = 3;
199
200    // The object being mapped is an attribute.
201    ATTRIBUTE = 4;
202
203    // The object being mapped is a relation alias.
204    RELATION_ALIAS = 5;
205
206    // The object being mapped is a an attribute alias.
207    ATTRIBUTE_ALIAS = 6;
208
209    // The object being mapped is a function.
210    FUNCTION = 7;
211  }
212
213  // The type of object that is being mapped.
214  Type type = 1;
215
216  // The database name (BigQuery project ID equivalent in the source data
217  // warehouse).
218  string database = 2;
219
220  // The schema name (BigQuery dataset equivalent in the source data warehouse).
221  string schema = 3;
222
223  // The relation name (BigQuery table or view equivalent in the source data
224  // warehouse).
225  string relation = 4;
226
227  // The attribute name (BigQuery column equivalent in the source data
228  // warehouse).
229  string attribute = 5;
230}
231
232// The potential components of a full name mapping that will be mapped
233// during translation in the target data warehouse.
234message NameMappingValue {
235  // The database name (BigQuery project ID equivalent in the target data
236  // warehouse).
237  string database = 1;
238
239  // The schema name (BigQuery dataset equivalent in the target data warehouse).
240  string schema = 2;
241
242  // The relation name (BigQuery table or view equivalent in the target data
243  // warehouse).
244  string relation = 3;
245
246  // The attribute name (BigQuery column equivalent in the target data
247  // warehouse).
248  string attribute = 4;
249}
250
251// Represents the default source environment values for the translation.
252message SourceEnv {
253  // The default database name to fully qualify SQL objects when their database
254  // name is missing.
255  string default_database = 1;
256
257  // The schema search path. When SQL objects are missing schema name,
258  // translation engine will search through this list to find the value.
259  repeated string schema_search_path = 2;
260}
261