-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Marcel Coetzee <[email protected]>
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
) |