mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-12 20:53:48 +00:00
feat(datasource): Database connection Renewal (#2359)
Co-authored-by: aries_ckt <916701291@qq.com> Co-authored-by: Fangyin Cheng <staneyffer@gmail.com> Co-authored-by: ‘yanzhiyonggit config --global user.email git config --global user.name ‘yanzhiyong <zhiyong.yan@clife.cn>
This commit is contained in:
@@ -133,7 +133,7 @@ class SparkConnector(BaseConnector):
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
def query_ex(self, sql: str):
|
||||
def query_ex(self, sql: str, timeout: Optional[float] = None):
|
||||
"""Execute sql command."""
|
||||
rows = self.run(sql)
|
||||
field_names = rows[0]
|
||||
|
@@ -38,7 +38,8 @@ class TuGraphParameters(BaseDatasourceParameters):
|
||||
"Database password, you can write your password directly, of course, "
|
||||
"you can also use environment variables, such as "
|
||||
"${env:DBGPT_DB_PASSWORD}"
|
||||
)
|
||||
),
|
||||
"tags": "privacy",
|
||||
},
|
||||
)
|
||||
port: int = field(
|
||||
|
@@ -46,7 +46,8 @@ class ClickhouseParameters(BaseDatasourceParameters):
|
||||
"Database password, you can write your password directly, of course, "
|
||||
"you can also use environment variables, such as "
|
||||
"${env:DBGPT_DB_PASSWORD}"
|
||||
)
|
||||
),
|
||||
"tags": "privacy",
|
||||
},
|
||||
)
|
||||
http_pool_maxsize: int = field(
|
||||
|
@@ -24,7 +24,11 @@ from dbgpt.util.i18n_utils import _
|
||||
)
|
||||
@dataclass
|
||||
class DorisParameters(RDBMSDatasourceParameters):
|
||||
"""Doris connection parameters."""
|
||||
"""Doris connection parameters.
|
||||
|
||||
Doris has a same protocol with MySQL, so we suggest to use MySQL connector to
|
||||
connect Doris.
|
||||
"""
|
||||
|
||||
__type__ = "doris"
|
||||
driver: str = field(
|
||||
|
@@ -50,7 +50,11 @@ class HiveParameters(BaseDatasourceParameters):
|
||||
default="", metadata={"help": _("Username for authentication")}
|
||||
)
|
||||
password: str = field(
|
||||
default="", metadata={"help": _("Password for LDAP or CUSTOM auth")}
|
||||
default="",
|
||||
metadata={
|
||||
"help": _("Password for LDAP or CUSTOM auth"),
|
||||
"tags": "privacy",
|
||||
},
|
||||
)
|
||||
|
||||
# Kerberos parameters
|
||||
@@ -170,3 +174,9 @@ class HiveConnector(RDBMSConnector):
|
||||
def get_charset(self):
|
||||
"""Get character_set of current database."""
|
||||
return "UTF-8"
|
||||
|
||||
def _format_sql(self, sql: str) -> str:
|
||||
"""Format sql."""
|
||||
sql = super()._format_sql(sql)
|
||||
# remove ';' at the end of sql
|
||||
return sql.rstrip(";")
|
||||
|
Reference in New Issue
Block a user