From ced70af3ab4091f096caa97635f9af9d80bf7c62 Mon Sep 17 00:00:00 2001 From: Violetta Mishechkina Date: Fri, 9 Aug 2024 17:53:40 +0200 Subject: [PATCH] Change name to enable_dataset_name_normalization --- dlt/common/destination/reference.py | 6 +++--- docs/website/docs/general-usage/naming-convention.md | 8 ++++---- tests/common/test_destination.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlt/common/destination/reference.py b/dlt/common/destination/reference.py index 67b8105ace..3af7dcff13 100644 --- a/dlt/common/destination/reference.py +++ b/dlt/common/destination/reference.py @@ -190,7 +190,7 @@ class DestinationClientDwhConfiguration(DestinationClientConfiguration): """How to handle replace disposition for this destination, can be classic or staging""" staging_dataset_name_layout: str = "%s_staging" """Layout for staging dataset, where %s is replaced with dataset name. placeholder is optional""" - dataset_name_normalization: bool = True + enable_dataset_name_normalization: bool = True """Whether to normalize the dataset name. Affects staging dataset as well.""" def _bind_dataset_name( @@ -215,7 +215,7 @@ def normalize_dataset_name(self, schema: Schema) -> str: else: return ( schema.naming.normalize_table_identifier(dataset_name) - if self.dataset_name_normalization + if self.enable_dataset_name_normalization else dataset_name ) @@ -234,7 +234,7 @@ def normalize_staging_dataset_name(self, schema: Schema) -> str: return ( schema.naming.normalize_table_identifier(dataset_name) - if self.dataset_name_normalization + if self.enable_dataset_name_normalization else dataset_name ) diff --git a/docs/website/docs/general-usage/naming-convention.md b/docs/website/docs/general-usage/naming-convention.md index 48265b9ee2..11032a4457 100644 --- a/docs/website/docs/general-usage/naming-convention.md +++ b/docs/website/docs/general-usage/naming-convention.md @@ -114,11 +114,11 @@ You can pick from a few built-in naming conventions. ### Ignore naming convention for `dataset_name` -You control the dataset naming normalization separately. Set `dataset_name_normalization` to `false` to ignore the naming convention for `dataset_name`: +You control the dataset naming normalization separately. Set `enable_dataset_name_normalization` to `false` to ignore the naming convention for `dataset_name`: ```toml [destination.snowflake] -dataset_name_normalization=false +enable_dataset_name_normalization=false ``` In that case, the `dataset_name` would be preserved the same as it was set in the pipeline: @@ -128,9 +128,9 @@ import dlt pipeline = dlt.pipeline(dataset_name="MyCamelCaseName") ``` -The default value for the `dataset_name_normalization` configuration option is `true`. +The default value for the `enable_dataset_name_normalization` configuration option is `true`. :::note -The same setting would be applied to [staging dataset](../dlt-ecosystem/staging#staging-dataset). Thus, if you set `dataset_name_normalization` to `false`, the staging dataset name would also **not** be normalized. +The same setting would be applied to [staging dataset](../dlt-ecosystem/staging#staging-dataset). Thus, if you set `enable_dataset_name_normalization` to `false`, the staging dataset name would also **not** be normalized. ::: :::caution diff --git a/tests/common/test_destination.py b/tests/common/test_destination.py index aab4500fe8..f04820bf36 100644 --- a/tests/common/test_destination.py +++ b/tests/common/test_destination.py @@ -353,7 +353,7 @@ def test_normalize_dataset_name() -> None: # test dataset_name_normalization false assert ( - DestinationClientDwhConfiguration(dataset_name_normalization=False) + DestinationClientDwhConfiguration(enable_dataset_name_normalization=False) ._bind_dataset_name(dataset_name="BarbaPapa__Ba", default_schema_name="default") .normalize_dataset_name(Schema("default")) == "BarbaPapa__Ba" @@ -407,7 +407,7 @@ def test_normalize_staging_dataset_name() -> None: # test dataset_name_normalization false assert ( DestinationClientDwhConfiguration( - dataset_name_normalization=False, staging_dataset_name_layout="%s__Staging" + enable_dataset_name_normalization=False, staging_dataset_name_layout="%s__Staging" ) ._bind_dataset_name(dataset_name="BarbaPapa__Ba", default_schema_name="default") .normalize_staging_dataset_name(Schema("default"))