mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-14 13:40:54 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user