refactor: The first refactored version for sdk release (#907)

Co-authored-by: chengfangyin2 <chengfangyin3@jd.com>
This commit is contained in:
FangYin Cheng
2023-12-08 14:45:59 +08:00
committed by GitHub
parent e7e4aff667
commit cd725db1fb
573 changed files with 2094 additions and 3571 deletions

59
dbgpt/datasource/base.py Normal file
View File

@@ -0,0 +1,59 @@
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""We need to design a base class. That other connector can Write with this"""
from abc import ABC, abstractmethod
from typing import Any, Iterable, List, Optional
class BaseConnect(ABC):
def get_connect(self, db_name: str):
pass
def get_table_names(self) -> Iterable[str]:
pass
def get_table_info(self, table_names: Optional[List[str]] = None) -> str:
pass
def get_index_info(self, table_names: Optional[List[str]] = None) -> str:
pass
def get_example_data(self, table: str, count: int = 3):
pass
def get_database_list(self):
pass
def get_database_names(self):
pass
def get_table_comments(self, db_name):
pass
def run(self, session, command: str, fetch: str = "all") -> List:
pass
def run_to_df(self, command: str, fetch: str = "all"):
pass
def get_users(self):
pass
def get_grants(self):
pass
def get_collation(self):
pass
def get_charset(self):
pass
def get_fields(self, table_name):
pass
def get_show_create_table(self, table_name):
pass
def get_indexes(self, table_name):
pass