-
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
1 changed file
with
50 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,50 @@ | ||
from typing import AnyStr, Any, ContextManager, Optional, Sequence | ||
|
||
import clickhouse_driver | ||
from clickhouse_driver.dbapi.extras import DictCursor | ||
|
||
from dlt.destinations.sql_client import DBApiCursorImpl, SqlClientBase | ||
from dlt.destinations.typing import DBTransaction, DBApiCursor, TNativeConn | ||
|
||
|
||
class ClickhouseDBApiCursorImpl(DBApiCursorImpl): | ||
native_cursor: DictCursor | ||
|
||
|
||
class ClickhouseSqlClient(SqlClientBase[clickhouse_driver.Client], DBTransaction): | ||
def open_connection(self) -> TNativeConn: | ||
pass | ||
|
||
def close_connection(self) -> None: | ||
pass | ||
|
||
def begin_transaction(self) -> ContextManager[DBTransaction]: | ||
pass | ||
|
||
@property | ||
def native_connection(self) -> TNativeConn: | ||
pass | ||
|
||
def execute_sql( | ||
self, sql: AnyStr, *args: Any, **kwargs: Any | ||
) -> Optional[Sequence[Sequence[Any]]]: | ||
pass | ||
|
||
def execute_query( | ||
self, query: AnyStr, *args: Any, **kwargs: Any | ||
) -> ContextManager[DBApiCursor]: | ||
pass | ||
|
||
def fully_qualified_dataset_name(self, escape: bool = True) -> str: | ||
pass | ||
|
||
@staticmethod | ||
def _make_database_exception(ex: Exception) -> Exception: | ||
pass | ||
|
||
|
||
class TransactionsNotImplementedError(NotImplementedError): | ||
def __init__(self) -> None: | ||
super().__init__( | ||
"Clickhouse does not support transaction management." | ||
) |