From 3ce3be65b6e1dc69754745e499272bd0ca7490cd Mon Sep 17 00:00:00 2001 From: TenYearOldJAVA <50320537+TenYearOldJAVA@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:54:02 +0800 Subject: [PATCH] fix: doris_conn cannot get table comment to store vectordb (#2490) Co-authored-by: Zhihe.Liu --- .../src/dbgpt_ext/datasource/rdbms/conn_doris.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/conn_doris.py b/packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/conn_doris.py index aa6ab213a..e8833a027 100644 --- a/packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/conn_doris.py +++ b/packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/conn_doris.py @@ -201,6 +201,21 @@ class DorisConnector(RDBMSConnector): tables = cursor.fetchall() return [(table[0], table[1]) for table in tables] + def get_table_comment(self, table_name=None): + """Get table comment.""" + cursor = self.get_session().execute( + text( + f"SELECT TABLE_COMMENT " + f"FROM information_schema.tables " + f"where TABLE_NAME={table_name} and TABLE_SCHEMA=database()" + ) + ) + table_comment = cursor.fetchone() + if table_comment: + return {"text": str(table_comment[0])} + else: + return {"text": None} + def get_database_names(self): """Get database names.""" with self.session_scope() as session: