mirror of
https://github.com/CodePhiliaX/Chat2DB.git
synced 2025-07-29 18:53:12 +08:00
fix clickhouse view ddl query
This commit is contained in:
@ -38,8 +38,7 @@ public class ClickHouseMetaData extends DefaultMetaService implements MetaData {
|
|||||||
= "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS where TRIGGER_SCHEMA = '%s';";
|
= "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS where TRIGGER_SCHEMA = '%s';";
|
||||||
private static String SELECT_TABLE_COLUMNS = "select * from `system`.columns where table ='%s' and database='%s';";
|
private static String SELECT_TABLE_COLUMNS = "select * from `system`.columns where table ='%s' and database='%s';";
|
||||||
private static String VIEW_SQL
|
private static String VIEW_SQL
|
||||||
= "SELECT TABLE_SCHEMA AS DatabaseName, TABLE_NAME AS ViewName, VIEW_DEFINITION AS definition, CHECK_OPTION, "
|
= "SELECT create_table_query from system.`tables` WHERE `database`='%s' and name='%s'";
|
||||||
+ "IS_UPDATABLE FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s';";
|
|
||||||
private List<String> systemDatabases = Arrays.asList("information_schema", "system");
|
private List<String> systemDatabases = Arrays.asList("information_schema", "system");
|
||||||
|
|
||||||
public static String format(String tableName) {
|
public static String format(String tableName) {
|
||||||
@ -214,7 +213,7 @@ public class ClickHouseMetaData extends DefaultMetaService implements MetaData {
|
|||||||
table.setSchemaName(schemaName);
|
table.setSchemaName(schemaName);
|
||||||
table.setName(viewName);
|
table.setName(viewName);
|
||||||
if (resultSet.next()) {
|
if (resultSet.next()) {
|
||||||
table.setDdl(resultSet.getString("definition"));
|
table.setDdl(resultSet.getString(1));
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user