@cubejs-backend/hive-driver 0.30.73 → 0.31.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.31.0](https://github.com/cube-js/cube.js/compare/v0.30.75...v0.31.0) (2022-10-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * multiple data source ([#5326](https://github.com/cube-js/cube.js/issues/5326)) ([334af8c](https://github.com/cube-js/cube.js/commit/334af8c56cd02ae551844e9d1e9ab5e107fb1555))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.30.73](https://github.com/cube-js/cube.js/compare/v0.30.72...v0.30.73) (2022-09-19)
7
18
 
8
19
  **Note:** Version bump only for package @cubejs-backend/hive-driver
@@ -2,6 +2,7 @@ const jshs2 = require('jshs2');
2
2
  const SqlString = require('sqlstring');
3
3
  const genericPool = require('generic-pool');
4
4
  const { BaseDriver } = require('@cubejs-backend/base-driver');
5
+ const { getEnv, assertDataSource } = require('@cubejs-backend/shared');
5
6
 
6
7
  const {
7
8
  HS2Util, IDLContainer, HiveConnection, Configuration
@@ -36,6 +37,9 @@ IDLFactory.extractConfig = (config) => {
36
37
 
37
38
  const TSaslTransport = require('./TSaslTransport');
38
39
 
40
+ /**
41
+ * Hive driver class.
42
+ */
39
43
  class HiveDriver extends BaseDriver {
40
44
  /**
41
45
  * Returns default concurrency value.
@@ -44,24 +48,36 @@ class HiveDriver extends BaseDriver {
44
48
  return 2;
45
49
  }
46
50
 
51
+ /**
52
+ * Class constructor.
53
+ */
47
54
  constructor(config = {}) {
48
55
  super();
56
+
57
+ const dataSource =
58
+ config.dataSource ||
59
+ assertDataSource('default');
60
+
49
61
  this.config = {
50
62
  auth: 'PLAIN',
51
- host: process.env.CUBEJS_DB_HOST,
52
- port: process.env.CUBEJS_DB_PORT,
53
- dbName: process.env.CUBEJS_DB_NAME || 'default',
63
+ host: getEnv('dbHost', { dataSource }),
64
+ port: getEnv('dbPort', { dataSource }),
65
+ dbName: getEnv('dbName', { dataSource }) || 'default',
54
66
  timeout: 10000,
55
- username: process.env.CUBEJS_DB_USER,
56
- password: process.env.CUBEJS_DB_PASS,
57
- hiveType: process.env.CUBEJS_DB_HIVE_TYPE === 'CDH' ? HS2Util.HIVE_TYPE.CDH : HS2Util.HIVE_TYPE.HIVE,
58
- hiveVer: process.env.CUBEJS_DB_HIVE_VER || '2.1.1',
59
- thriftVer: process.env.CUBEJS_DB_HIVE_THRIFT_VER || '0.9.3',
60
- cdhVer: process.env.CUBEJS_DB_HIVE_CDH_VER,
67
+ username: getEnv('dbUser', { dataSource }),
68
+ password: getEnv('dbPass', { dataSource }),
69
+ hiveType: getEnv('hiveType', { dataSource }) === 'CDH'
70
+ ? HS2Util.HIVE_TYPE.CDH
71
+ : HS2Util.HIVE_TYPE.HIVE,
72
+ hiveVer: getEnv('hiveVer', { dataSource }) || '2.1.1',
73
+ thriftVer: getEnv('hiveThriftVer', { dataSource }) || '0.9.3',
74
+ cdhVer: getEnv('hiveCdhVer', { dataSource }),
61
75
  authZid: 'cube.js',
62
76
  ...config
63
77
  };
78
+
64
79
  const configuration = new Configuration(this.config);
80
+
65
81
  this.pool = genericPool.createPool({
66
82
  create: async () => {
67
83
  const idl = new IDLContainer();
@@ -102,7 +118,10 @@ class HiveDriver extends BaseDriver {
102
118
  destroy: (connection) => connection.close()
103
119
  }, {
104
120
  min: 0,
105
- max: this.config.maxPoolSize || 8,
121
+ max:
122
+ config.maxPoolSize ||
123
+ getEnv('dbMaxPoolSize', { dataSource }) ||
124
+ 8,
106
125
  evictionRunIntervalMillis: 10000,
107
126
  softIdleTimeoutMillis: 30000,
108
127
  idleTimeoutMillis: 30000,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cubejs-backend/hive-driver",
3
3
  "description": "Cube.js Hive database driver",
4
4
  "author": "Cube Dev, Inc.",
5
- "version": "0.30.73",
5
+ "version": "0.31.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/cube-js/cube.js.git",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "main": "driver/HiveDriver.js",
15
15
  "dependencies": {
16
- "@cubejs-backend/base-driver": "^0.30.73",
16
+ "@cubejs-backend/base-driver": "^0.31.0",
17
17
  "generic-pool": "^3.6.0",
18
18
  "jshs2": "^0.4.4",
19
19
  "sasl-plain": "^0.1.0",
@@ -25,5 +25,5 @@
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
28
- "gitHead": "d47987e8eab041fd9b5113feb3ab8f35afe38e16"
28
+ "gitHead": "8cdec759f298fb20c48194254ccc04b6fdad46bf"
29
29
  }