diff --git a/dlt/destinations/impl/clickhouse/clickhouse.py b/dlt/destinations/impl/clickhouse/clickhouse.py index e69de29bb2..cb9a72493b 100644 --- a/dlt/destinations/impl/clickhouse/clickhouse.py +++ b/dlt/destinations/impl/clickhouse/clickhouse.py @@ -0,0 +1,32 @@ +from typing import ClassVar, Optional + +from dlt.common.destination import DestinationCapabilitiesContext +from dlt.common.destination.reference import SupportsStagingDestination +from dlt.common.schema import Schema, TColumnSchema +from dlt.common.schema.typing import TColumnType, TTableFormat +from dlt.destinations.impl.clickhouse import capabilities +from dlt.destinations.impl.clickhouse.configuration import ClickhouseClientConfiguration +from dlt.destinations.job_client_impl import SqlJobClientWithStaging +from dlt.destinations.sql_client import SqlClientBase +from dlt.destinations.typing import TNativeConn + + +class ClickhouseClient(SqlJobClientWithStaging, SupportsStagingDestination): + capabilities: ClassVar[DestinationCapabilitiesContext] = capabilities() + + def __init__( + self, + schema: Schema, + config: ClickhouseClientConfiguration, + sql_client: SqlClientBase[TNativeConn], + ) -> None: + super().__init__(schema, config, sql_client) + ... + + def _get_column_def_sql(self, c: TColumnSchema, table_format: TTableFormat = None) -> str: + pass + + def _from_db_type( + self, db_type: str, precision: Optional[int], scale: Optional[int] + ) -> TColumnType: + pass diff --git a/dlt/destinations/impl/clickhouse/factory.py b/dlt/destinations/impl/clickhouse/factory.py index e69de29bb2..0734abdf56 100644 --- a/dlt/destinations/impl/clickhouse/factory.py +++ b/dlt/destinations/impl/clickhouse/factory.py @@ -0,0 +1,44 @@ +import typing as t + +from dlt.common.destination import Destination, DestinationCapabilitiesContext +from dlt.destinations.impl.clickhouse import capabilities +from dlt.destinations.impl.clickhouse.configuration import ( + ClickhouseClientConfiguration, + ClickhouseCredentials, +) + + +if t.TYPE_CHECKING: + from dlt.destinations.impl.clickhouse.clickhouse import ClickhouseClient + + +# noinspection PyPep8Naming +class clickhouse(Destination[ClickhouseClientConfiguration, ClickhouseClient]): + spec = ClickhouseClientConfiguration + + def capabilities(self) -> DestinationCapabilitiesContext: + return capabilities() + + @property + def client_class(self) -> t.Type["ClickhouseClient"]: + from dlt.destinations.impl.clickhouse.clickhouse import ClickhouseClient + + return ClickhouseClient + + def __init__( + self, + credentials: ClickhouseCredentials = None, + dataset_name: str = None, + default_schema_name: str = None, + destination_name: str = None, + environment: str = None, + **kwargs: t.Any, + ) -> None: + super().__init__( + credentials=credentials, + dataset_name=dataset_name, + default_schema_name=default_schema_name, + destination_name=destination_name, + environment=environment, + **kwargs, + )