translation_task.proto 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. syntax = "proto3";
  15. package google.cloud.bigquery.migration.v2alpha;
  16. option csharp_namespace = "Google.Cloud.BigQuery.Migration.V2Alpha";
  17. option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha;migration";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "TranslationTaskProto";
  20. option java_package = "com.google.cloud.bigquery.migration.v2alpha";
  21. option php_namespace = "Google\\Cloud\\BigQuery\\Migration\\V2alpha";
  22. // Mapping between an input and output file to be translated in a subtask.
  23. message TranslationFileMapping {
  24. // The Cloud Storage path for a file to translation in a subtask.
  25. string input_path = 1;
  26. // The Cloud Storage path to write back the corresponding input file to.
  27. string output_path = 2;
  28. }
  29. // The translation task config to capture necessary settings for a translation
  30. // task and subtask.
  31. message TranslationTaskDetails {
  32. // The file encoding types.
  33. enum FileEncoding {
  34. // File encoding setting is not specified.
  35. FILE_ENCODING_UNSPECIFIED = 0;
  36. // File encoding is UTF_8.
  37. UTF_8 = 1;
  38. // File encoding is ISO_8859_1.
  39. ISO_8859_1 = 2;
  40. // File encoding is US_ASCII.
  41. US_ASCII = 3;
  42. // File encoding is UTF_16.
  43. UTF_16 = 4;
  44. // File encoding is UTF_16LE.
  45. UTF_16LE = 5;
  46. // File encoding is UTF_16BE.
  47. UTF_16BE = 6;
  48. }
  49. // The special token data type.
  50. enum TokenType {
  51. // Token type is not specified.
  52. TOKEN_TYPE_UNSPECIFIED = 0;
  53. // Token type as string.
  54. STRING = 1;
  55. // Token type as integer.
  56. INT64 = 2;
  57. // Token type as numeric.
  58. NUMERIC = 3;
  59. // Token type as boolean.
  60. BOOL = 4;
  61. // Token type as float.
  62. FLOAT64 = 5;
  63. // Token type as date.
  64. DATE = 6;
  65. // Token type as timestamp.
  66. TIMESTAMP = 7;
  67. }
  68. // The language specific settings for the translation task.
  69. oneof language_options {
  70. // The Teradata SQL specific settings for the translation task.
  71. TeradataOptions teradata_options = 10;
  72. // The BTEQ specific settings for the translation task.
  73. BteqOptions bteq_options = 11;
  74. }
  75. // The Cloud Storage path for translation input files.
  76. string input_path = 1;
  77. // The Cloud Storage path for translation output files.
  78. string output_path = 2;
  79. // Cloud Storage files to be processed for translation.
  80. repeated TranslationFileMapping file_paths = 12;
  81. // The Cloud Storage path to DDL files as table schema to assist semantic
  82. // translation.
  83. string schema_path = 3;
  84. // The file encoding type.
  85. FileEncoding file_encoding = 4;
  86. // The settings for SQL identifiers.
  87. IdentifierSettings identifier_settings = 5;
  88. // The map capturing special tokens to be replaced during translation. The key
  89. // is special token in string. The value is the token data type. This is used
  90. // to translate SQL query template which contains special token as place
  91. // holder. The special token makes a query invalid to parse. This map will be
  92. // applied to annotate those special token with types to let parser understand
  93. // how to parse them into proper structure with type information.
  94. map<string, TokenType> special_token_map = 6;
  95. // The filter applied to translation details.
  96. Filter filter = 7;
  97. // Specifies the exact name of the bigquery table ("dataset.table") to be used
  98. // for surfacing raw translation errors. If the table does not exist, we will
  99. // create it. If it already exists and the schema is the same, we will re-use.
  100. // If the table exists and the schema is different, we will throw an error.
  101. string translation_exception_table = 13;
  102. }
  103. // The filter applied to fields of translation details.
  104. message Filter {
  105. // The list of prefixes used to exclude processing for input files.
  106. repeated string input_file_exclusion_prefixes = 1;
  107. }
  108. // Settings related to SQL identifiers.
  109. message IdentifierSettings {
  110. // The identifier case type.
  111. enum IdentifierCase {
  112. // The identifier case is not specified.
  113. IDENTIFIER_CASE_UNSPECIFIED = 0;
  114. // Identifiers' cases will be kept as the original cases.
  115. ORIGINAL = 1;
  116. // Identifiers will be in upper cases.
  117. UPPER = 2;
  118. // Identifiers will be in lower cases.
  119. LOWER = 3;
  120. }
  121. // The SQL identifier rewrite mode.
  122. enum IdentifierRewriteMode {
  123. // SQL Identifier rewrite mode is unspecified.
  124. IDENTIFIER_REWRITE_MODE_UNSPECIFIED = 0;
  125. // SQL identifiers won't be rewrite.
  126. NONE = 1;
  127. // All SQL identifiers will be rewrite.
  128. REWRITE_ALL = 2;
  129. }
  130. // The setting to control output queries' identifier case.
  131. IdentifierCase output_identifier_case = 1;
  132. // Specifies the rewrite mode for SQL identifiers.
  133. IdentifierRewriteMode identifier_rewrite_mode = 2;
  134. }
  135. // Teradata SQL specific translation task related settings.
  136. message TeradataOptions {
  137. }
  138. // BTEQ translation task related settings.
  139. message BteqOptions {
  140. // Specifies the project and dataset in BigQuery that will be used for
  141. // external table creation during the translation.
  142. DatasetReference project_dataset = 1;
  143. // The Cloud Storage location to be used as the default path for files that
  144. // are not otherwise specified in the file replacement map.
  145. string default_path_uri = 2;
  146. // Maps the local paths that are used in BTEQ scripts (the keys) to the paths
  147. // in Cloud Storage that should be used in their stead in the translation (the
  148. // value).
  149. map<string, string> file_replacement_map = 3;
  150. }
  151. // Reference to a BigQuery dataset.
  152. message DatasetReference {
  153. // A unique ID for this dataset, without the project name. The ID
  154. // must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_).
  155. // The maximum length is 1,024 characters.
  156. string dataset_id = 1;
  157. // The ID of the project containing this dataset.
  158. string project_id = 2;
  159. }