mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-01 08:11:45 +00:00
1. group_concat() not supported in clickhouse, use arrayStringConcat+groupArray instead
This commit is contained in:
parent
6da082bc62
commit
f8cb208dc4
@ -106,3 +106,13 @@ class ClickhouseConnect(RDBMSDatabase):
|
|||||||
return [
|
return [
|
||||||
(table_comment[0], table_comment[1]) for table_comment in table_comments
|
(table_comment[0], table_comment[1]) for table_comment in table_comments
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def table_simple_info(self):
|
||||||
|
# group_concat() not supported in clickhouse, use arrayStringConcat+groupArray instead; and quotes need to be escaped
|
||||||
|
_sql = f"""
|
||||||
|
select concat(TABLE_NAME, \'(\' , arrayStringConcat(groupArray(column_name),\'-\'), \')\') as schema_info
|
||||||
|
from information_schema.COLUMNS where table_schema=\'{self.get_current_db_name()}\' group by TABLE_NAME; """
|
||||||
|
|
||||||
|
cursor = self.session.execute(text(_sql))
|
||||||
|
results = cursor.fetchall()
|
||||||
|
return results
|
||||||
|
Loading…
Reference in New Issue
Block a user