@transitive-sdk/clickhouse 0.6.0 → 0.6.2

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,
@@ -485,11 +485,10 @@ class ClickHouse {
485
485
  const orgUser = `org_${orgId}_user`;
486
486
 
487
487
  // Check if user exists
488
- const userExists = await ClickHouse.client.query({
488
+ const userExists = await this.client.query({
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) {
@@ -521,7 +520,7 @@ class ClickHouse {
521
520
  // Immediately revoke select access to system tables again (see
522
521
  // https://clickhouse.com/docs/sql-reference/statements/revoke#examples):
523
522
  `REVOKE SELECT ON system.* FROM ${orgUser}`,
524
- ]) await ClickHouse.client.command({ query });
523
+ ]) await this.client.command({ query });
525
524
 
526
525
  // store user and password in mongo
527
526
  if (accountsCollection) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transitive-sdk/clickhouse",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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({