mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-14 13:40:54 +00:00
fix: Editor page with redundant table fields of the same name in othe… (#1765)
Co-authored-by: 王玉东 <wangyudong@qiyi.com>
This commit is contained in:
@@ -155,16 +155,17 @@ class ClickhouseConnector(RDBMSConnector):
|
||||
"""Return string representation of dialect to use."""
|
||||
return ""
|
||||
|
||||
def get_fields(self, table_name) -> List[Tuple]:
|
||||
def get_fields(self, table_name, db_name=None) -> List[Tuple]:
|
||||
"""Get column fields about specified table."""
|
||||
session = self.client
|
||||
|
||||
_query_sql = f"""
|
||||
SELECT name, type, default_expression, is_in_primary_key, comment
|
||||
from system.columns where table='{table_name}'
|
||||
""".format(
|
||||
table_name
|
||||
)
|
||||
if db_name is not None:
|
||||
_query_sql += f" AND database='{db_name}'"
|
||||
with session.query_row_block_stream(_query_sql) as stream:
|
||||
fields = [block for block in stream] # noqa
|
||||
return fields
|
||||
|
Reference in New Issue
Block a user