mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-05 18:33:52 +00:00
fix: doris_conn cannot get table comment to store vectordb (#2490)
Co-authored-by: Zhihe.Liu <zhihe.liu@majorbio.com>
This commit is contained in:
parent
52e41bccc9
commit
3ce3be65b6
@ -201,6 +201,21 @@ class DorisConnector(RDBMSConnector):
|
|||||||
tables = cursor.fetchall()
|
tables = cursor.fetchall()
|
||||||
return [(table[0], table[1]) for table in tables]
|
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):
|
def get_database_names(self):
|
||||||
"""Get database names."""
|
"""Get database names."""
|
||||||
with self.session_scope() as session:
|
with self.session_scope() as session:
|
||||||
|
Loading…
Reference in New Issue
Block a user