cubejs-jdbc-driver-for-msfabric 0.0.2 → 1.3.1

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.
@@ -3,8 +3,9 @@
3
3
  * @license Apache-2.0
4
4
  * @fileoverview The `MSFabricDriver` and related types declaration.
5
5
  */
6
- import { JDBCDriver, JDBCDriverConfiguration } from '@cubejs-backend/jdbc-driver';
7
- import { MSFabricQuery } from './MSFabricQuery';
6
+ import { DriverCapabilities } from "@cubejs-backend/base-driver";
7
+ import { JDBCDriver, JDBCDriverConfiguration } from "@cubejs-backend/jdbc-driver";
8
+ import { MSFabricQuery } from "./MSFabricQuery";
8
9
  export type MSFabricDriverConfiguration = JDBCDriverConfiguration & {
9
10
  /**
10
11
  * Driver read-only mode flag.
@@ -22,6 +23,7 @@ export declare class MSFabricDriver extends JDBCDriver {
22
23
  /**
23
24
  * Read-only mode flag.
24
25
  */
26
+ protected readonly config: MSFabricDriverConfiguration;
25
27
  static dialectClass(): typeof MSFabricQuery;
26
28
  /**
27
29
  * Returns default concurrency value.
@@ -30,9 +32,50 @@ export declare class MSFabricDriver extends JDBCDriver {
30
32
  /**
31
33
  * Class constructor.
32
34
  */
35
+ constructor(conf?: Partial<MSFabricDriverConfiguration> & {
36
+ /**
37
+ * Data source name.
38
+ */
39
+ dataSource?: string;
40
+ /**
41
+ * Max pool size value for the [cube]<-->[db] pool.
42
+ */
43
+ maxPoolSize?: number;
44
+ /**
45
+ * Time to wait for a response from a connection after validation
46
+ * request before determining it as not valid. Default - 10000 ms.
47
+ */
48
+ testConnectionTimeout?: number;
49
+ });
33
50
  /**
34
51
  * @override
35
52
  */
53
+ readOnly(): boolean;
54
+ /**
55
+ * @override
56
+ */
57
+ capabilities(): DriverCapabilities;
58
+ /**
59
+ * @override
60
+ */
61
+ setLogger(logger: any): void;
62
+ /**
63
+ * @override
64
+ */
65
+ loadPreAggregationIntoTable(preAggregationTableName: string, loadSql: string, params: unknown[], _options: any): Promise<unknown[]>;
66
+ /**
67
+ * @override
68
+ */
69
+ query<R = unknown>(query: string, values: unknown[]): Promise<R[]>;
70
+ /**
71
+ * Returns pre-aggregation schema name.
72
+ */
73
+ getPreaggsSchemaName(): string;
74
+ showDeprecations(): void;
75
+ /**
76
+ * Returns quoted string.
77
+ */
78
+ quoteIdentifier(identifier: string): string;
36
79
  /**
37
80
  * Returns the JS type by the MSFabric type.
38
81
  */
@@ -6,24 +6,16 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.MSFabricDriver = void 0;
9
- // import {
10
- // getEnv,
11
- // assertDataSource,
12
- // } from '@cubejs-backend/shared';
13
- // import { DriverCapabilities } from '@cubejs-backend/base-driver';
9
+ const shared_1 = require("@cubejs-backend/shared");
14
10
  const jdbc_driver_1 = require("@cubejs-backend/jdbc-driver");
15
11
  const MSFabricQuery_1 = require("./MSFabricQuery");
16
12
  const MSFabricToGenericType = {
17
- 'decimal(10,0)': 'bigint'
13
+ "decimal(10,0)": "bigint",
18
14
  };
19
15
  /**
20
16
  * MSFabric driver class.
21
17
  */
22
18
  class MSFabricDriver extends jdbc_driver_1.JDBCDriver {
23
- /**
24
- * Read-only mode flag.
25
- */
26
- // protected readonly config: MSFabricDriverConfiguration;
27
19
  static dialectClass() {
28
20
  return MSFabricQuery_1.MSFabricQuery;
29
21
  }
@@ -36,126 +28,75 @@ class MSFabricDriver extends jdbc_driver_1.JDBCDriver {
36
28
  /**
37
29
  * Class constructor.
38
30
  */
39
- // public constructor(
40
- // conf: Partial<MSFabricDriverConfiguration> & {
41
- // /**
42
- // * Data source name.
43
- // */
44
- // dataSource?: string,
45
- // /**
46
- // * Max pool size value for the [cube]<-->[db] pool.
47
- // */
48
- // maxPoolSize?: number,
49
- // /**
50
- // * Time to wait for a response from a connection after validation
51
- // * request before determining it as not valid. Default - 10000 ms.
52
- // */
53
- // testConnectionTimeout?: number,
54
- // } = {},
55
- // ) {
56
- // // const dataSource =
57
- // // conf.dataSource ||
58
- // // assertDataSource('default');
59
- // // let url: string =
60
- // // conf?.url ||
61
- // // getEnv('dataSource');
62
- // const config: MSFabricDriverConfiguration = {
63
- // ...conf,
64
- // properties: conf?.properties || {},
65
- // database: conf?.database || 'master',
66
- // url: conf?.url || `jdbc:sqlserver://localhost`,
67
- // dbType: 'msfabric-jdbc',
68
- // drivername: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
69
- // // customClassPath: undefined,
70
- // // properties: {
71
- // // // PWD-parameter passed to the connection string has higher priority,
72
- // // // so we can set this one to an empty string to avoid a Java error.
73
- // // PWD:
74
- // // getEnv('sqlPassword', { dataSource }) ||
75
- // // '',
76
- // // UserAgentEntry: 'CubeDev_Cube',
77
- // // },
78
- // // database: getEnv('dbName', { required: false, dataSource }),
79
- // // pollInterval: (
80
- // // conf?.pollInterval ||
81
- // // getEnv('dbPollMaxInterval', { dataSource })
82
- // // ) * 1000,
83
- // };
84
- // super(config);
85
- // this.config = config;
86
- // }
31
+ constructor(conf = {}) {
32
+ const config = {
33
+ ...conf,
34
+ properties: (conf === null || conf === void 0 ? void 0 : conf.properties) || {},
35
+ database: (conf === null || conf === void 0 ? void 0 : conf.database) || "master",
36
+ url: (conf === null || conf === void 0 ? void 0 : conf.url) || `jdbc:sqlserver://localhost`,
37
+ dbType: "msfabric-jdbc",
38
+ drivername: "com.microsoft.sqlserver.jdbc.SQLServerDriver",
39
+ };
40
+ super(config);
41
+ this.config = config;
42
+ }
43
+ /**
44
+ * @override
45
+ */
46
+ readOnly() {
47
+ return !!this.config.readOnly;
48
+ }
49
+ /**
50
+ * @override
51
+ */
52
+ capabilities() {
53
+ return { unloadWithoutTempTable: true };
54
+ }
55
+ /**
56
+ * @override
57
+ */
58
+ setLogger(logger) {
59
+ super.setLogger(logger);
60
+ this.showDeprecations();
61
+ }
87
62
  /**
88
63
  * @override
89
64
  */
90
- // public readOnly() {
91
- // return !!this.config.readOnly;
92
- // }
93
- // /**
94
- // * @override
95
- // */
96
- // public capabilities(): DriverCapabilities {
97
- // return { unloadWithoutTempTable: true };
98
- // }
99
- // /**
100
- // * @override
101
- // */
102
- // public setLogger(logger: any) {
103
- // super.setLogger(logger);
104
- // this.showDeprecations();
105
- // }
106
- // /**
107
- // * @override
108
- // */
109
- // public async loadPreAggregationIntoTable(
110
- // preAggregationTableName: string,
111
- // loadSql: string,
112
- // params: unknown[],
113
- // _options: any,
114
- // ) {
115
- // return super.loadPreAggregationIntoTable(
116
- // preAggregationTableName,
117
- // loadSql,
118
- // params,
119
- // _options,
120
- // );
121
- // }
122
- // /**
123
- // * @override
124
- // */
125
- // public async query<R = unknown>(
126
- // query: string,
127
- // values: unknown[],
128
- // ): Promise<R[]> {
129
- // return super.query(query, values);
130
- // }
131
- // // /**
132
- // // * Returns pre-aggregation schema name.
133
- // // */
134
- // // public getPreaggsSchemaName(): string {
135
- // // const schema = getEnv('preAggregationsSchema');
136
- // // if (schema) {
137
- // // return schema;
138
- // // } else {
139
- // // const devMode =
140
- // // process.env.NODE_ENV !== 'production' || getEnv('devMode');
141
- // // return devMode
142
- // // ? 'dev_pre_aggregations'
143
- // // : 'prod_pre_aggregations';
144
- // // }
145
- // // }
146
- // public showDeprecations() {
147
- // }
148
- // /**
149
- // * Returns quoted string.
150
- // */
151
- // public quoteIdentifier(identifier: string): string {
152
- // return `\`${identifier}\``;
153
- // }
65
+ async loadPreAggregationIntoTable(preAggregationTableName, loadSql, params, _options) {
66
+ return super.loadPreAggregationIntoTable(preAggregationTableName, loadSql, params, _options);
67
+ }
68
+ /**
69
+ * @override
70
+ */
71
+ async query(query, values) {
72
+ return super.query(query, values);
73
+ }
74
+ /**
75
+ * Returns pre-aggregation schema name.
76
+ */
77
+ getPreaggsSchemaName() {
78
+ const schema = (0, shared_1.getEnv)("preAggregationsSchema");
79
+ if (schema) {
80
+ return schema;
81
+ }
82
+ else {
83
+ const devMode = process.env.NODE_ENV !== "production" || (0, shared_1.getEnv)("devMode");
84
+ return devMode ? "dev_pre_aggregations" : "prod_pre_aggregations";
85
+ }
86
+ }
87
+ showDeprecations() { }
88
+ /**
89
+ * Returns quoted string.
90
+ */
91
+ quoteIdentifier(identifier) {
92
+ return `\`${identifier}\``;
93
+ }
154
94
  /**
155
95
  * Returns the JS type by the MSFabric type.
156
96
  */
157
97
  toGenericType(columnType) {
158
- return MSFabricToGenericType[columnType.toLowerCase()] || super.toGenericType(columnType);
98
+ return (MSFabricToGenericType[columnType.toLowerCase()] ||
99
+ super.toGenericType(columnType));
159
100
  }
160
101
  }
161
102
  exports.MSFabricDriver = MSFabricDriver;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "cubejs-jdbc-driver-for-msfabric",
3
3
  "description": "Cube.js MS Fabric database driver",
4
4
  "author": "RamSoft Inc.",
5
- "version": "0.0.2",
5
+ "version": "1.3.1",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
@@ -28,6 +28,7 @@
28
28
  "dependencies": {
29
29
  "@cubejs-backend/base-driver": "^1.3.34",
30
30
  "@cubejs-backend/jdbc-driver": "^1.3.34",
31
+ "@cubejs-backend/mssql-driver": "^1.3.34",
31
32
  "@cubejs-backend/schema-compiler": "^1.3.34",
32
33
  "@cubejs-backend/shared": "^1.3.34"
33
34
  },