mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 01:26:01 +00:00
clickhouse - view support, incremental structure update
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
const columns = require('./columns');
|
||||
const tables = require('./tables');
|
||||
const views = require('./views');
|
||||
const tableModifications = require('./tableModifications');
|
||||
|
||||
module.exports = {
|
||||
columns,
|
||||
tables,
|
||||
views,
|
||||
tableModifications,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
module.exports = `
|
||||
select metadata_modification_time as "contentHash", uuid as "objectId", engine as "tableEngine"
|
||||
from system.tables
|
||||
where database='#DATABASE#';
|
||||
`;
|
||||
@@ -2,5 +2,5 @@ module.exports = `
|
||||
select name as "pureName", metadata_modification_time as "contentHash", total_rows as "tableRowCount", uuid as "objectId", comment as "objectComment",
|
||||
engine as "tableEngine", primary_key as "primaryKeyColumns", sorting_key as "sortingKeyColumns"
|
||||
from system.tables
|
||||
where database='#DATABASE#' and uuid =OBJECT_ID_CONDITION;
|
||||
where database='#DATABASE#' and uuid =OBJECT_ID_CONDITION and engine != 'View';
|
||||
`;
|
||||
|
||||
10
plugins/dbgate-plugin-clickhouse/src/backend/sql/views.js
Normal file
10
plugins/dbgate-plugin-clickhouse/src/backend/sql/views.js
Normal file
@@ -0,0 +1,10 @@
|
||||
module.exports = `
|
||||
select
|
||||
tables.name as "pureName",
|
||||
tables.uuid as "objectId",
|
||||
views.view_definition as "viewDefinition",
|
||||
tables.metadata_modification_time as "contentHash"
|
||||
from information_schema.views
|
||||
inner join system.tables on views.table_name = tables.name and views.table_schema = tables.database
|
||||
where views.table_schema='#DATABASE#' and tables.uuid =OBJECT_ID_CONDITION
|
||||
`;
|
||||
Reference in New Issue
Block a user