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.
- package/dist/src/MSFabricDriver.d.ts +45 -2
- package/dist/src/MSFabricDriver.js +64 -123
- package/package.json +2 -1
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* @license Apache-2.0
|
|
4
4
|
* @fileoverview The `MSFabricDriver` and related types declaration.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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()] ||
|
|
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": "
|
|
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
|
},
|