@transitive-sdk/clickhouse 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -97,7 +97,7 @@ class ClickHouse {
97
97
  },
98
98
  });
99
99
 
100
- await this._client.query({ query: 'SELECT 1' });
100
+ await this._client.command({ query: 'SELECT 1' });
101
101
 
102
102
  // start interval for batch insertion
103
103
  setInterval(this.batchInsertCache.bind(this), interval);
@@ -138,7 +138,7 @@ class ClickHouse {
138
138
  ${settings.join(' ')}`;
139
139
 
140
140
  try {
141
- return await this.client.exec({
141
+ return await this.client.command({
142
142
  query,
143
143
  clickhouse_settings: {
144
144
  wait_end_of_query: 1,
@@ -489,7 +489,6 @@ class ClickHouse {
489
489
  query: `SELECT name FROM system.users WHERE name = '${orgUser}'`,
490
490
  format: 'JSONEachRow'
491
491
  });
492
-
493
492
  const users = await userExists.json();
494
493
 
495
494
  if (users.length > 0) {
@@ -514,13 +513,13 @@ class ClickHouse {
514
513
 
515
514
  for (let query of [
516
515
  // Create user:
517
- `CREATE USER IF NOT EXISTS ${orgUser} IDENTIFIED WITH plaintext_password BY '${orgPassword}'`,
516
+ `CREATE USER IF NOT EXISTS '${orgUser}' IDENTIFIED WITH plaintext_password BY '${orgPassword}'`,
518
517
  // Grant read only access to all databases and tables - row level security
519
518
  // will limit access to own org data:
520
- `GRANT SELECT ON *.* TO ${orgUser}`,
519
+ `GRANT SELECT ON *.* TO '${orgUser}'`,
521
520
  // Immediately revoke select access to system tables again (see
522
521
  // https://clickhouse.com/docs/sql-reference/statements/revoke#examples):
523
- `REVOKE SELECT ON system.* FROM ${orgUser}`,
522
+ `REVOKE SELECT ON system.* FROM '${orgUser}'`,
524
523
  ]) await this.client.command({ query });
525
524
 
526
525
  // store user and password in mongo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitive-sdk/clickhouse",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "A tiny ClickHouse utility class for use in the Transitive framework.",
5
5
  "homepage": "https://transitiverobotics.com",
6
6
  "repository": {
@@ -70,8 +70,7 @@ describe('ClickHouse', function() {
70
70
 
71
71
  describe('basics', () => {
72
72
  it('creates tables without crashing', async () => {
73
- const result = await clickhouse.createTable('test_tmp',
74
- ['text String']);
73
+ await clickhouse.createTable('test_tmp', ['text String']);
75
74
 
76
75
  // clean up
77
76
  await clickhouse.client.command({