From c4bcfe398e7e75b474ef4a64a3c332586ba2f993 Mon Sep 17 00:00:00 2001 From: Marcin Rudolf Date: Thu, 22 Feb 2024 12:52:04 +0100 Subject: [PATCH] does not lowercase postgres and redshift database names --- dlt/destinations/impl/postgres/configuration.py | 3 --- tests/load/postgres/test_postgres_client.py | 4 +++- tests/load/redshift/test_redshift_table_builder.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dlt/destinations/impl/postgres/configuration.py b/dlt/destinations/impl/postgres/configuration.py index 1433d9f641..f1d30a7342 100644 --- a/dlt/destinations/impl/postgres/configuration.py +++ b/dlt/destinations/impl/postgres/configuration.py @@ -25,9 +25,6 @@ def parse_native_representation(self, native_value: Any) -> None: if not self.is_partial(): self.resolve() - def on_resolved(self) -> None: - self.database = self.database.lower() - def to_url(self) -> URL: url = super().to_url() url.update_query_pairs([("connect_timeout", str(self.connect_timeout))]) diff --git a/tests/load/postgres/test_postgres_client.py b/tests/load/postgres/test_postgres_client.py index 83b59bddaf..daabf6fc51 100644 --- a/tests/load/postgres/test_postgres_client.py +++ b/tests/load/postgres/test_postgres_client.py @@ -37,8 +37,10 @@ def test_postgres_credentials_defaults() -> None: assert pg_cred.connect_timeout == 15 assert PostgresCredentials.__config_gen_annotations__ == ["port", "connect_timeout"] # port should be optional - resolve_configuration(pg_cred, explicit_value="postgres://loader:loader@localhost/dlt_data") + resolve_configuration(pg_cred, explicit_value="postgres://loader:loader@localhost/DLT_DATA") assert pg_cred.port == 5432 + # preserve case + assert pg_cred.database == "DLT_DATA" def test_postgres_credentials_native_value(environment) -> None: diff --git a/tests/load/redshift/test_redshift_table_builder.py b/tests/load/redshift/test_redshift_table_builder.py index 4ad66b6f6b..e280dd94e0 100644 --- a/tests/load/redshift/test_redshift_table_builder.py +++ b/tests/load/redshift/test_redshift_table_builder.py @@ -42,7 +42,7 @@ def test_redshift_configuration() -> None: } ): C = resolve_configuration(RedshiftCredentials(), sections=("destination", "my_redshift")) - assert C.database == "upper_case_database" + assert C.database == "UPPER_CASE_DATABASE" assert C.password == "pass" # check fingerprint