Skip to content

Commit

Permalink
Change name to enable_dataset_name_normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletM committed Aug 9, 2024
1 parent f828d00 commit ced70af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions dlt/common/destination/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
)

Expand All @@ -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
)

Expand Down
8 changes: 4 additions & 4 deletions docs/website/docs/general-usage/naming-convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/common/test_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit ced70af

Please sign in to comment.