Skip to content

Commit fd09c32

Browse files
authored
🎉 Base Normalization: quote schema name to allow reserved keywords (#14683)
Signed-off-by: Sergey Chvalyuk <[email protected]>
1 parent bb66bc7 commit fd09c32

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

‎airbyte-integrations/bases/base-normalization/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ WORKDIR /airbyte
2828
ENV AIRBYTE_ENTRYPOINT "/airbyte/entrypoint.sh"
2929
ENTRYPOINT ["/airbyte/entrypoint.sh"]
3030

31-
LABEL io.airbyte.version=0.2.12
31+
LABEL io.airbyte.version=0.2.13
3232
LABEL io.airbyte.name=airbyte/normalization

‎airbyte-integrations/bases/base-normalization/normalization/transform_catalog/destination_name_transformer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,15 @@ def __normalize_identifier_name(
181181
return f"'{result}'"
182182
return result
183183

184-
def apply_quote(self, input: str) -> str:
184+
def apply_quote(self, input: str, literal=True) -> str:
185+
if literal:
186+
input = f"'{input}'"
185187
if self.destination_type == DestinationType.ORACLE:
186188
# Oracle dbt lib doesn't implemented adapter quote yet.
187-
return f"quote('{input}')"
189+
return f"quote({input})"
188190
elif self.destination_type == DestinationType.CLICKHOUSE:
189-
return f"quote('{input}')"
190-
return f"adapter.quote('{input}')"
191+
return f"quote({input})"
192+
return f"adapter.quote({input})"
191193

192194
def __normalize_naming_conventions(self, input_name: str, is_column: bool = False) -> str:
193195
result = input_name

‎airbyte-integrations/bases/base-normalization/normalization/transform_catalog/stream_processor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1242,7 +1242,10 @@ def add_to_outputs(
12421242
quoted_unique_key=self.get_unique_key(in_jinja=True),
12431243
active_row_column_name=active_row_column_name,
12441244
normalized_at_incremental_clause=self.get_incremental_clause_for_column(
1245-
"this.schema + '.' + " + self.name_transformer.apply_quote(final_table_name),
1245+
"{} + '.' + {}".format(
1246+
self.name_transformer.apply_quote("this.schema", literal=False),
1247+
self.name_transformer.apply_quote(final_table_name),
1248+
),
12461249
self.get_normalized_at(in_jinja=True),
12471250
),
12481251
unique_key_reference=unique_key_reference,

‎airbyte-workers/src/main/java/io/airbyte/workers/normalization/NormalizationRunnerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
public class NormalizationRunnerFactory {
1515

1616
public static final String BASE_NORMALIZATION_IMAGE_NAME = "airbyte/normalization";
17-
public static final String NORMALIZATION_VERSION = "0.2.12";
17+
public static final String NORMALIZATION_VERSION = "0.2.13";
1818

1919
static final Map<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>> NORMALIZATION_MAPPING =
2020
ImmutableMap.<String, ImmutablePair<String, DefaultNormalizationRunner.DestinationType>>builder()

‎docs/understanding-airbyte/basic-normalization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,9 @@ Therefore, in order to "upgrade" to the desired normalization version, you need
353353

354354
| Airbyte Version | Normalization Version | Date | Pull Request | Subject |
355355
|:----------------|:----------------------|:-----------| :--- |:---------------------------------------------------------------------------|
356-
| | 0.2.11 | 2022-07-26 | [\#13591](https://github.com/airbytehq/airbyte/pull/13591) | Updated support for integer columns. |
356+
| | 0.2.13 | 2022-07-27 | [\#14683](https://github.com/airbytehq/airbyte/pull/14683) | Quote schema name to allow reserved keywords |
357357
| | 0.2.12 | 2022-07-26 | [\#14362](https://github.com/airbytehq/airbyte/pull/14362) | Handle timezone in date-time format. Parse date correct in clickhouse. |
358+
| | 0.2.11 | 2022-07-26 | [\#13591](https://github.com/airbytehq/airbyte/pull/13591) | Updated support for integer columns. |
358359
| | 0.2.10 | 2022-07-18 | [\#14792](https://github.com/airbytehq/airbyte/pull/14792) | Add support for key pair auth for snowflake |
359360
| | 0.2.9 | 2022-07-06 | [\#14485](https://github.com/airbytehq/airbyte/pull/14485) | BigQuery partition pruning otimization |
360361
| | 0.2.8 | 2022-07-13 | [\#14522](https://github.com/airbytehq/airbyte/pull/14522) | BigQuery replaces `NULL` array entries with the string value `"NULL"` |
@@ -400,4 +401,3 @@ Therefore, in order to "upgrade" to the desired normalization version, you need
400401
| 0.28.2-alpha | 0.1.38 | 2021-07-28 | [\#5027](https://github.com/airbytehq/airbyte/pull/5027) | Handle quotes in column names when parsing JSON blob |
401402
| 0.27.5-alpha | 0.1.37 | 2021-07-22 | [\#3947](https://github.com/airbytehq/airbyte/pull/4881/) | Handle `NULL` cursor field values when deduping |
402403
| 0.27.2-alpha | 0.1.36 | 2021-07-09 | [\#3947](https://github.com/airbytehq/airbyte/pull/4163/) | Enable normalization for MySQL destination |
403-

0 commit comments

Comments
 (0)