fix: clickhouse connect error fix (#958)

Co-authored-by: Magic <magic@B-4TMH9N3X-2120.local>
Co-authored-by: aries_ckt <916701291@qq.com>
This commit is contained in:
magic.chen
2023-12-22 11:44:26 +08:00
committed by GitHub
parent d9065227bd
commit 681a8e2ed5
26 changed files with 630 additions and 91 deletions

View File

@@ -3,7 +3,7 @@
"""We need to design a base class. That other connector can Write with this"""
from abc import ABC
from typing import Iterable, List, Optional
from typing import Iterable, List, Optional, Any, Dict
class BaseConnect(ABC):
@@ -50,7 +50,7 @@ class BaseConnect(ABC):
"""Get database names."""
pass
def get_table_comments(self, db_name):
def get_table_comments(self, db_name: str):
"""Get table comments.
Args:
@@ -58,6 +58,33 @@ class BaseConnect(ABC):
"""
pass
def get_table_comment(self, table_name: str) -> Dict:
"""Get table comment.
Args:
table_name (str): table name
Returns:
comment: Dict, which contains text: Optional[str], eg:["text": "comment"]
"""
pass
def get_columns(self, table_name: str) -> List[Dict]:
"""Get columns.
Args:
table_name (str): table name
Returns:
columns: List[Dict], which contains name: str, type: str, default_expression: str, is_in_primary_key: bool, comment: str
eg:[{'name': 'id', 'type': 'int', 'default_expression': '', 'is_in_primary_key': True, 'comment': 'id'}, ...]
"""
pass
def get_column_comments(self, db_name, table_name):
"""Get column comments.
Args:
table_name (_type_): _description_
"""
pass
def run(self, command: str, fetch: str = "all") -> List:
"""Execute sql command.
@@ -99,8 +126,13 @@ class BaseConnect(ABC):
"""Get the creation table sql about specified table."""
pass
def get_indexes(self, table_name):
"""Get table indexes about specified table."""
def get_indexes(self, table_name: str) -> List[Dict]:
"""Get table indexes about specified table.
Args:
table_name (str): table name
Returns:
indexes: List[Dict], eg:[{'name': 'idx_key', 'column_names': ['id']}]
"""
pass
@classmethod