mirror of
https://github.com/lingble/clickhouse.git
synced 2025-11-03 04:27:47 +00:00
drop supports also on cluster
This commit is contained in:
2
index.js
2
index.js
@@ -492,7 +492,7 @@ class QueryCursor {
|
|||||||
// Hack for Sequelize ORM
|
// Hack for Sequelize ORM
|
||||||
query = query.trim().trimEnd().replace(/;$/gm, "");
|
query = query.trim().trimEnd().replace(/;$/gm, "");
|
||||||
|
|
||||||
if (query.match(/^(select|show|exists|create)/i)) {
|
if (query.match(/^(select|show|exists|create|drop)/i)) {
|
||||||
if ( ! R_FORMAT_PARSER.test(query)) {
|
if ( ! R_FORMAT_PARSER.test(query)) {
|
||||||
query += ` FORMAT ${ClickHouse.getFullFormatName(me.format)}`;
|
query += ` FORMAT ${ClickHouse.getFullFormatName(me.format)}`;
|
||||||
}
|
}
|
||||||
|
|||||||
13
test/test.js
13
test/test.js
@@ -36,14 +36,19 @@ before(async () => {
|
|||||||
|
|
||||||
describe('On cluster', () => {
|
describe('On cluster', () => {
|
||||||
// Note: this test only works with ClickHouse setup as Cluster named test_cluster
|
// Note: this test only works with ClickHouse setup as Cluster named test_cluster
|
||||||
it('should be able to create table', async () => {
|
it('should be able to create and drop a table', async () => {
|
||||||
const query = `
|
const createTableQuery = `
|
||||||
CREATE TABLE ${database}.test_on_cluster ON CLUSTER test_cluster (
|
CREATE TABLE ${database}.test_on_cluster ON CLUSTER test_cluster (
|
||||||
test String
|
test String
|
||||||
)
|
)
|
||||||
ENGINE=MergeTree ORDER BY test;`;
|
ENGINE=MergeTree ORDER BY test;`;
|
||||||
const r = await clickhouse.query(query).toPromise();
|
const createTableQueryResult = await clickhouse.query(createTableQuery).toPromise();
|
||||||
expect(r).to.be.ok();
|
expect(createTableQueryResult).to.be.ok();
|
||||||
|
|
||||||
|
const dropTableQuery = `
|
||||||
|
DROP TABLE ${database}.test_on_cluster ON CLUSTER test_cluster;`;
|
||||||
|
const dropTableQueryResult = await clickhouse.query(dropTableQuery).toPromise();
|
||||||
|
expect(dropTableQueryResult).to.be.ok();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user