mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-06 19:04:24 +00:00
fix(clickhouse): fix information_schema (#999)
This commit is contained in:
parent
6aa48007ba
commit
33ea58f497
@ -93,7 +93,7 @@ class ClickhouseConnect(RDBMSDatabase):
|
|||||||
"""
|
"""
|
||||||
session = self.client
|
session = self.client
|
||||||
|
|
||||||
_query_sql = f"""
|
_query_sql = f"""
|
||||||
SELECT name AS table, primary_key, from system.tables where database ='{self.client.database}' and table = '{table_name}'
|
SELECT name AS table, primary_key, from system.tables where database ='{self.client.database}' and table = '{table_name}'
|
||||||
"""
|
"""
|
||||||
with session.query_row_block_stream(_query_sql) as stream:
|
with session.query_row_block_stream(_query_sql) as stream:
|
||||||
@ -150,7 +150,7 @@ class ClickhouseConnect(RDBMSDatabase):
|
|||||||
"""Get column fields about specified table."""
|
"""Get column fields about specified table."""
|
||||||
session = self.client
|
session = self.client
|
||||||
|
|
||||||
_query_sql = f"""
|
_query_sql = f"""
|
||||||
SELECT name, type, default_expression, is_in_primary_key, comment from system.columns where table='{table_name}'
|
SELECT name, type, default_expression, is_in_primary_key, comment from system.columns where table='{table_name}'
|
||||||
""".format(
|
""".format(
|
||||||
table_name
|
table_name
|
||||||
@ -275,7 +275,7 @@ class ClickhouseConnect(RDBMSDatabase):
|
|||||||
|
|
||||||
_sql = f"""
|
_sql = f"""
|
||||||
SELECT concat(TABLE_NAME, '(', arrayStringConcat(groupArray(column_name), '-'), ')') AS schema_info
|
SELECT concat(TABLE_NAME, '(', arrayStringConcat(groupArray(column_name), '-'), ')') AS schema_info
|
||||||
FROM information_schema.COLUMNS
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
WHERE table_schema = '{self.get_current_db_name()}'
|
WHERE table_schema = '{self.get_current_db_name()}'
|
||||||
GROUP BY TABLE_NAME
|
GROUP BY TABLE_NAME
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user