@databricks/sql 0.1.8-beta.2 → 1.0.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +1 -3
  3. package/dist/DBSQLClient.d.ts +18 -7
  4. package/dist/DBSQLClient.js +40 -13
  5. package/dist/DBSQLClient.js.map +1 -1
  6. package/dist/DBSQLLogger.d.ts +12 -0
  7. package/dist/DBSQLLogger.js +43 -0
  8. package/dist/DBSQLLogger.js.map +1 -0
  9. package/dist/DBSQLOperation/FetchResultsHelper.d.ts +1 -1
  10. package/dist/DBSQLOperation/FetchResultsHelper.js +1 -1
  11. package/dist/DBSQLOperation/FetchResultsHelper.js.map +1 -1
  12. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +3 -3
  13. package/dist/DBSQLOperation/OperationStatusHelper.js +8 -8
  14. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -1
  15. package/dist/DBSQLOperation/index.d.ts +27 -6
  16. package/dist/DBSQLOperation/index.js +53 -14
  17. package/dist/DBSQLOperation/index.js.map +1 -1
  18. package/dist/DBSQLSession.d.ts +82 -12
  19. package/dist/DBSQLSession.js +114 -112
  20. package/dist/DBSQLSession.js.map +1 -1
  21. package/dist/connection/connections/HttpConnection.js +9 -6
  22. package/dist/connection/connections/HttpConnection.js.map +1 -1
  23. package/dist/contracts/IDBSQLClient.d.ts +11 -4
  24. package/dist/contracts/IDBSQLLogger.d.ts +13 -0
  25. package/dist/contracts/IDBSQLLogger.js +11 -0
  26. package/dist/contracts/IDBSQLLogger.js.map +1 -0
  27. package/dist/contracts/IDBSQLSession.d.ts +53 -41
  28. package/dist/contracts/IOperation.d.ts +15 -12
  29. package/dist/contracts/IOperation.js +0 -4
  30. package/dist/contracts/IOperation.js.map +1 -1
  31. package/dist/index.d.ts +3 -1
  32. package/dist/index.js +5 -1
  33. package/dist/index.js.map +1 -1
  34. package/package.json +5 -2
@@ -3,45 +3,68 @@ import IOperation from './IOperation';
3
3
  import Status from '../dto/Status';
4
4
  import InfoValue from '../dto/InfoValue';
5
5
  import { Int64 } from '../hive/Types';
6
- export declare type CrossReferenceRequest = {
7
- parentCatalogName: string;
8
- parentSchemaName: string;
9
- parentTableName: string;
10
- foreignCatalogName: string;
11
- foreignSchemaName: string;
12
- foreignTableName: string;
13
- };
14
6
  export declare type ExecuteStatementOptions = {
15
- runAsync?: boolean;
16
- confOverlay?: Record<string, string>;
17
7
  queryTimeout?: Int64;
18
- maxRows?: number;
8
+ runAsync?: boolean;
9
+ maxRows?: number | null;
10
+ };
11
+ export declare type TypeInfoRequest = {
12
+ runAsync?: boolean;
13
+ maxRows?: number | null;
14
+ };
15
+ export declare type CatalogsRequest = {
16
+ runAsync?: boolean;
17
+ maxRows?: number | null;
19
18
  };
20
19
  export declare type SchemasRequest = {
21
- schemaName?: string;
22
20
  catalogName?: string;
21
+ schemaName?: string;
22
+ runAsync?: boolean;
23
+ maxRows?: number | null;
23
24
  };
24
25
  export declare type TablesRequest = {
25
26
  catalogName?: string;
26
27
  schemaName?: string;
27
28
  tableName?: string;
28
29
  tableTypes?: Array<string>;
30
+ runAsync?: boolean;
31
+ maxRows?: number | null;
32
+ };
33
+ export declare type TableTypesRequest = {
34
+ runAsync?: boolean;
35
+ maxRows?: number | null;
29
36
  };
30
- export declare type ColumnRequest = {
37
+ export declare type ColumnsRequest = {
31
38
  catalogName?: string;
32
39
  schemaName?: string;
33
40
  tableName?: string;
34
41
  columnName?: string;
42
+ runAsync?: boolean;
43
+ maxRows?: number | null;
35
44
  };
36
- export declare type FunctionNameRequest = {
37
- functionName: string;
45
+ export declare type FunctionsRequest = {
38
46
  catalogName?: string;
39
47
  schemaName?: string;
48
+ functionName: string;
49
+ runAsync?: boolean;
50
+ maxRows?: number | null;
40
51
  };
41
52
  export declare type PrimaryKeysRequest = {
53
+ catalogName?: string;
42
54
  schemaName: string;
43
55
  tableName: string;
44
- catalogName?: string;
56
+ runAsync?: boolean;
57
+ maxRows?: number | null;
58
+ };
59
+ export declare type CrossReferenceRequest = {
60
+ parentCatalogName: string;
61
+ parentSchemaName: string;
62
+ parentTableName: string;
63
+ foreignCatalogName: string;
64
+ foreignSchemaName: string;
65
+ foreignTableName: string;
66
+ runAsync?: boolean;
67
+ maxRows?: number | null;
45
68
  };
46
69
  export default interface IDBSQLSession {
47
70
  /**
@@ -58,41 +81,47 @@ export default interface IDBSQLSession {
58
81
  */
59
82
  executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
60
83
  /**
61
- * Informataion about supported data types
84
+ * Information about supported data types
85
+ *
86
+ * @param request
62
87
  */
63
- getTypeInfo(): Promise<IOperation>;
88
+ getTypeInfo(request?: TypeInfoRequest): Promise<IOperation>;
64
89
  /**
65
90
  * Get list of catalogs
91
+ *
92
+ * @param request
66
93
  */
67
- getCatalogs(): Promise<IOperation>;
94
+ getCatalogs(request?: CatalogsRequest): Promise<IOperation>;
68
95
  /**
69
96
  * Get list of databases
70
97
  *
71
98
  * @param request
72
99
  */
73
- getSchemas(request: SchemasRequest): Promise<IOperation>;
100
+ getSchemas(request?: SchemasRequest): Promise<IOperation>;
74
101
  /**
75
102
  * Get list of tables
76
103
  *
77
104
  * @param request
78
105
  */
79
- getTables(request: TablesRequest): Promise<IOperation>;
106
+ getTables(request?: TablesRequest): Promise<IOperation>;
80
107
  /**
81
108
  * Get list of supported table types
109
+ *
110
+ * @param request
82
111
  */
83
- getTableTypes(): Promise<IOperation>;
112
+ getTableTypes(request?: TableTypesRequest): Promise<IOperation>;
84
113
  /**
85
114
  * Get full information about columns of the table
86
115
  *
87
116
  * @param request
88
117
  */
89
- getColumns(request: ColumnRequest): Promise<IOperation>;
118
+ getColumns(request?: ColumnsRequest): Promise<IOperation>;
90
119
  /**
91
120
  * Get information about function
92
121
  *
93
122
  * @param request
94
123
  */
95
- getFunctions(request: FunctionNameRequest): Promise<IOperation>;
124
+ getFunctions(request: FunctionsRequest): Promise<IOperation>;
96
125
  /**
97
126
  * Get primary keys of table
98
127
  *
@@ -104,23 +133,6 @@ export default interface IDBSQLSession {
104
133
  * @param request
105
134
  */
106
135
  getCrossReference(request: CrossReferenceRequest): Promise<IOperation>;
107
- /**
108
- * Get delegation token. For kerberos auth only
109
- *
110
- * @param owner
111
- * @param renewer
112
- */
113
- getDelegationToken(owner: string, renewer: string): Promise<string>;
114
- /**
115
- * Renew delegation token/ For kerberos auth only
116
- * @param token
117
- */
118
- renewDelegationToken(token: string): Promise<Status>;
119
- /**
120
- * Cancel delegation token. For kerberos auth only
121
- * @param token
122
- */
123
- cancelDelegationToken(token: string): Promise<Status>;
124
136
  /**
125
137
  * closes the session
126
138
  */
@@ -1,23 +1,26 @@
1
1
  import { TGetOperationStatusResp, TTableSchema } from '../../thrift/TCLIService_types';
2
2
  import Status from '../dto/Status';
3
3
  export declare type OperationStatusCallback = (progress: TGetOperationStatusResp) => unknown;
4
- export interface IFetchOptions {
5
- maxRows?: number;
4
+ export interface WaitUntilReadyOptions {
6
5
  progress?: boolean;
7
6
  callback?: OperationStatusCallback;
8
7
  }
9
- export declare const defaultFetchOptions: {
10
- maxRows: number;
11
- };
8
+ export interface FinishedOptions extends WaitUntilReadyOptions {
9
+ }
10
+ export interface FetchOptions extends WaitUntilReadyOptions {
11
+ maxRows?: number;
12
+ }
13
+ export interface GetSchemaOptions extends WaitUntilReadyOptions {
14
+ }
12
15
  export default interface IOperation {
13
16
  /**
14
- * Fetch schema and a portion of data
17
+ * Fetch a portion of data
15
18
  */
16
- fetchChunk(options?: IFetchOptions): Promise<Array<object>>;
19
+ fetchChunk(options?: FetchOptions): Promise<Array<object>>;
17
20
  /**
18
- * Fetch schema and all the data
21
+ * Fetch all the data
19
22
  */
20
- fetchAll(options?: IFetchOptions): Promise<Array<object>>;
23
+ fetchAll(options?: FetchOptions): Promise<Array<object>>;
21
24
  /**
22
25
  * Request status of operation
23
26
  *
@@ -35,13 +38,13 @@ export default interface IOperation {
35
38
  /**
36
39
  * Waits until operation is finished
37
40
  */
38
- finished(): Promise<void>;
41
+ finished(options?: FinishedOptions): Promise<void>;
39
42
  /**
40
43
  * Check if operation hasMoreRows
41
44
  */
42
45
  hasMoreRows(): Promise<boolean>;
43
46
  /**
44
- * Return retrieved schema
47
+ * Fetch schema
45
48
  */
46
- getSchema(): Promise<TTableSchema | null>;
49
+ getSchema(options?: GetSchemaOptions): Promise<TTableSchema | null>;
47
50
  }
@@ -1,7 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultFetchOptions = void 0;
4
- exports.defaultFetchOptions = {
5
- maxRows: 100000,
6
- };
7
3
  //# sourceMappingURL=IOperation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IOperation.js","sourceRoot":"","sources":["../../lib/contracts/IOperation.ts"],"names":[],"mappings":";;;AAWa,QAAA,mBAAmB,GAAG;IACjC,OAAO,EAAE,MAAM;CAChB,CAAC"}
1
+ {"version":3,"file":"IOperation.js","sourceRoot":"","sources":["../../lib/contracts/IOperation.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -2,10 +2,12 @@ import TCLIService from '../thrift/TCLIService';
2
2
  import TCLIService_types from '../thrift/TCLIService_types';
3
3
  import DBSQLClient from './DBSQLClient';
4
4
  import DBSQLSession from './DBSQLSession';
5
+ import DBSQLLogger from './DBSQLLogger';
5
6
  import NoSaslAuthentication from './connection/auth/NoSaslAuthentication';
6
7
  import PlainHttpAuthentication from './connection/auth/PlainHttpAuthentication';
7
8
  import HttpConnection from './connection/connections/HttpConnection';
8
9
  import { formatProgress } from './utils';
10
+ import { LogLevel } from './contracts/IDBSQLLogger';
9
11
  export declare const auth: {
10
12
  NoSaslAuthentication: typeof NoSaslAuthentication;
11
13
  PlainHttpAuthentication: typeof PlainHttpAuthentication;
@@ -20,4 +22,4 @@ export declare const thrift: {
20
22
  export declare const utils: {
21
23
  formatProgress: typeof formatProgress;
22
24
  };
23
- export { DBSQLClient, DBSQLSession };
25
+ export { DBSQLClient, DBSQLSession, DBSQLLogger, LogLevel };
package/dist/index.js CHANGED
@@ -3,17 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DBSQLSession = exports.DBSQLClient = exports.utils = exports.thrift = exports.connections = exports.auth = void 0;
6
+ exports.LogLevel = exports.DBSQLLogger = exports.DBSQLSession = exports.DBSQLClient = exports.utils = exports.thrift = exports.connections = exports.auth = void 0;
7
7
  const TCLIService_1 = __importDefault(require("../thrift/TCLIService"));
8
8
  const TCLIService_types_1 = __importDefault(require("../thrift/TCLIService_types"));
9
9
  const DBSQLClient_1 = __importDefault(require("./DBSQLClient"));
10
10
  exports.DBSQLClient = DBSQLClient_1.default;
11
11
  const DBSQLSession_1 = __importDefault(require("./DBSQLSession"));
12
12
  exports.DBSQLSession = DBSQLSession_1.default;
13
+ const DBSQLLogger_1 = __importDefault(require("./DBSQLLogger"));
14
+ exports.DBSQLLogger = DBSQLLogger_1.default;
13
15
  const NoSaslAuthentication_1 = __importDefault(require("./connection/auth/NoSaslAuthentication"));
14
16
  const PlainHttpAuthentication_1 = __importDefault(require("./connection/auth/PlainHttpAuthentication"));
15
17
  const HttpConnection_1 = __importDefault(require("./connection/connections/HttpConnection"));
16
18
  const utils_1 = require("./utils");
19
+ const IDBSQLLogger_1 = require("./contracts/IDBSQLLogger");
20
+ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function () { return IDBSQLLogger_1.LogLevel; } });
17
21
  exports.auth = {
18
22
  NoSaslAuthentication: NoSaslAuthentication_1.default,
19
23
  PlainHttpAuthentication: PlainHttpAuthentication_1.default,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAgD;AAChD,oFAA4D;AAC5D,gEAAwC;AAyB/B,sBAzBF,qBAAW,CAyBE;AAxBpB,kEAA0C;AAwBpB,uBAxBf,sBAAY,CAwBe;AAvBlC,kGAA0E;AAC1E,wGAAgF;AAChF,6FAAqE;AACrE,mCAAyC;AAE5B,QAAA,IAAI,GAAG;IAClB,oBAAoB,EAApB,8BAAoB;IACpB,uBAAuB,EAAvB,iCAAuB;CACxB,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,cAAc,EAAd,wBAAc;CACf,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,WAAW,EAAX,qBAAW;IACX,iBAAiB,EAAjB,2BAAiB;CAClB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,cAAc,EAAd,sBAAc;CACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAgD;AAChD,oFAA4D;AAC5D,gEAAwC;AA2B/B,sBA3BF,qBAAW,CA2BE;AA1BpB,kEAA0C;AA0BpB,uBA1Bf,sBAAY,CA0Be;AAzBlC,gEAAwC;AAyBJ,sBAzB7B,qBAAW,CAyB6B;AAxB/C,kGAA0E;AAC1E,wGAAgF;AAChF,6FAAqE;AACrE,mCAAyC;AACzC,2DAAoD;AAoBH,yFApBxC,uBAAQ,OAoBwC;AAlB5C,QAAA,IAAI,GAAG;IAClB,oBAAoB,EAApB,8BAAoB;IACpB,uBAAuB,EAAvB,iCAAuB;CACxB,CAAC;AAEW,QAAA,WAAW,GAAG;IACzB,cAAc,EAAd,wBAAc;CACf,CAAC;AAEW,QAAA,MAAM,GAAG;IACpB,WAAW,EAAX,qBAAW;IACX,iBAAiB,EAAjB,2BAAiB;CAClB,CAAC;AAEW,QAAA,KAAK,GAAG;IACnB,cAAc,EAAd,sBAAc;CACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/sql",
3
- "version": "0.1.8-beta.2",
3
+ "version": "1.0.0",
4
4
  "description": "Driver for connection to Databricks SQL via Thrift API.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -49,6 +49,7 @@
49
49
  "@types/node": "^18.0.0",
50
50
  "@types/node-int64": "^0.4.29",
51
51
  "@types/thrift": "^0.10.11",
52
+ "@types/uuid": "^8.3.4",
52
53
  "@typescript-eslint/eslint-plugin": "^5.33.1",
53
54
  "@typescript-eslint/parser": "^5.33.1",
54
55
  "chai": "^4.3.6",
@@ -69,6 +70,8 @@
69
70
  "dependencies": {
70
71
  "commander": "^9.3.0",
71
72
  "node-int64": "^0.4.0",
72
- "thrift": "^0.16.0"
73
+ "thrift": "^0.16.0",
74
+ "uuid": "^9.0.0",
75
+ "winston": "^3.8.2"
73
76
  }
74
77
  }