Skip to content

Commit

Permalink
aligns clickhouse config with dataclasses
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolfix committed Apr 10, 2024
1 parent 871aa4a commit 8ed4919
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
23 changes: 3 additions & 20 deletions dlt/destinations/impl/clickhouse/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)
...
2 changes: 1 addition & 1 deletion tests/load/clickhouse/test_clickhouse_table_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}"),
)


Expand Down

0 comments on commit 8ed4919

Please sign in to comment.