diff --git a/dlt/destinations/impl/clickhouse/configuration.py b/dlt/destinations/impl/clickhouse/configuration.py index 075150538d..34bac5b43b 100644 --- a/dlt/destinations/impl/clickhouse/configuration.py +++ b/dlt/destinations/impl/clickhouse/configuration.py @@ -73,9 +73,9 @@ def to_url(self) -> URL: @configspec class ClickHouseClientConfiguration(DestinationClientDwhWithStagingConfiguration): - destination_type: Final[str] = "clickhouse" # type: ignore[misc] - credentials: ClickHouseCredentials # type: ignore - dataset_name: Final[str] = "" # type: ignore + destination_type: Final[str] = dataclasses.field(default="clickhouse", init=False, repr=False, compare=False) # type: ignore[misc] + credentials: ClickHouseCredentials = None + dataset_name: Final[str] = dataclasses.field(default="", init=False, repr=False, compare=False) # type: ignore[misc] """dataset name in the destination to load data to, for schemas that are not default schema, it is used as dataset prefix""" # Primary key columns are used to build a sparse primary index which allows for efficient data retrieval, @@ -88,20 +88,3 @@ def fingerprint(self) -> str: if self.credentials and self.credentials.host: return digest128(self.credentials.host) return "" - - if TYPE_CHECKING: - - def __init__( - self, - *, - credentials: ClickHouseCredentials = None, - dataset_name: str = None, - destination_name: str = None, - environment: str = None - ) -> None: - super().__init__( - credentials=credentials, - destination_name=destination_name, - environment=environment, - ) - ... diff --git a/tests/load/clickhouse/test_clickhouse_table_builder.py b/tests/load/clickhouse/test_clickhouse_table_builder.py index 9d3fadfc47..9db87dc233 100644 --- a/tests/load/clickhouse/test_clickhouse_table_builder.py +++ b/tests/load/clickhouse/test_clickhouse_table_builder.py @@ -20,7 +20,7 @@ def clickhouse_client(empty_schema: Schema) -> ClickHouseClient: creds = ClickHouseCredentials() return ClickHouseClient( empty_schema, - ClickHouseClientConfiguration(dataset_name=f"test_{uniq_id()}", credentials=creds), + ClickHouseClientConfiguration(credentials=creds)._bind_dataset_name(f"test_{uniq_id()}"), )