@databricks/sql 1.3.0 → 1.4.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 (41) hide show
  1. package/dist/DBSQLClient.d.ts +1 -0
  2. package/dist/DBSQLClient.js +8 -1
  3. package/dist/DBSQLClient.js.map +1 -1
  4. package/dist/DBSQLOperation/OperationStatusHelper.d.ts +1 -1
  5. package/dist/DBSQLOperation/OperationStatusHelper.js +29 -6
  6. package/dist/DBSQLOperation/OperationStatusHelper.js.map +1 -1
  7. package/dist/DBSQLOperation/SchemaHelper.d.ts +1 -0
  8. package/dist/DBSQLOperation/SchemaHelper.js +20 -7
  9. package/dist/DBSQLOperation/SchemaHelper.js.map +1 -1
  10. package/dist/DBSQLOperation/index.d.ts +9 -2
  11. package/dist/DBSQLOperation/index.js +86 -10
  12. package/dist/DBSQLOperation/index.js.map +1 -1
  13. package/dist/DBSQLSession.d.ts +10 -1
  14. package/dist/DBSQLSession.js +72 -14
  15. package/dist/DBSQLSession.js.map +1 -1
  16. package/dist/contracts/IDBSQLSession.d.ts +1 -0
  17. package/dist/errors/OperationStateError.d.ts +10 -2
  18. package/dist/errors/OperationStateError.js +19 -2
  19. package/dist/errors/OperationStateError.js.map +1 -1
  20. package/dist/globalConfig.d.ts +2 -0
  21. package/dist/globalConfig.js +2 -0
  22. package/dist/globalConfig.js.map +1 -1
  23. package/dist/result/ArrowResult.d.ts +3 -2
  24. package/dist/result/ArrowResult.js +35 -17
  25. package/dist/result/ArrowResult.js.map +1 -1
  26. package/dist/result/CloudFetchResult.d.ts +13 -0
  27. package/dist/result/CloudFetchResult.js +69 -0
  28. package/dist/result/CloudFetchResult.js.map +1 -0
  29. package/dist/result/IOperationResult.d.ts +2 -1
  30. package/dist/result/JsonResult.d.ts +2 -1
  31. package/dist/result/JsonResult.js +24 -8
  32. package/dist/result/JsonResult.js.map +1 -1
  33. package/dist/utils/CloseableCollection.d.ts +10 -0
  34. package/dist/utils/CloseableCollection.js +40 -0
  35. package/dist/utils/CloseableCollection.js.map +1 -0
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/package.json +3 -1
  39. package/thrift/TCLIService.d.ts +43 -0
  40. package/thrift/TCLIService_types.d.ts +26 -6
  41. package/thrift/TCLIService_types.js +593 -284
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ class CloseableCollection {
13
+ constructor() {
14
+ this.items = new Set();
15
+ }
16
+ add(item) {
17
+ item.onClose = () => {
18
+ this.delete(item);
19
+ };
20
+ this.items.add(item);
21
+ }
22
+ delete(item) {
23
+ if (this.items.has(item)) {
24
+ item.onClose = undefined;
25
+ }
26
+ this.items.delete(item);
27
+ }
28
+ closeAll() {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const items = [...this.items];
31
+ for (const item of items) {
32
+ yield item.close(); // eslint-disable-line no-await-in-loop
33
+ item.onClose = undefined;
34
+ this.items.delete(item);
35
+ }
36
+ });
37
+ }
38
+ }
39
+ exports.default = CloseableCollection;
40
+ //# sourceMappingURL=CloseableCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloseableCollection.js","sourceRoot":"","sources":["../../lib/utils/CloseableCollection.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,MAAqB,mBAAmB;IAAxC;QACU,UAAK,GAAG,IAAI,GAAG,EAAK,CAAC;IAwB/B,CAAC;IAtBQ,GAAG,CAAC,IAAO;QAChB,IAAI,CAAC,OAAO,GAAG,GAAG,EAAE;YAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,IAAO;QACnB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;SAC1B;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAEY,QAAQ;;YACnB,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;gBACxB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,uCAAuC;gBAC3D,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aACzB;QACH,CAAC;KAAA;CACF;AAzBD,sCAyBC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.3.0";
1
+ declare const _default: "1.4.0";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.3.0';
3
+ exports.default = '1.4.0';
4
4
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/sql",
3
- "version": "1.3.0",
3
+ "version": "1.4.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",
@@ -50,6 +50,7 @@
50
50
  "license": "Apache 2.0",
51
51
  "devDependencies": {
52
52
  "@types/node": "^18.11.9",
53
+ "@types/node-fetch": "^2.6.4",
53
54
  "@types/node-int64": "^0.4.29",
54
55
  "@types/thrift": "^0.10.11",
55
56
  "@types/uuid": "^8.3.4",
@@ -73,6 +74,7 @@
73
74
  "dependencies": {
74
75
  "apache-arrow": "^10.0.1",
75
76
  "commander": "^9.3.0",
77
+ "node-fetch": "^2.6.12",
76
78
  "node-int64": "^0.4.0",
77
79
  "open": "^8.4.2",
78
80
  "openid-client": "^5.4.2",
@@ -97,6 +97,7 @@ import TExecuteStatementReq = ttypes.TExecuteStatementReq
97
97
  import TDBSqlStatement = ttypes.TDBSqlStatement
98
98
  import TSparkParameterValue = ttypes.TSparkParameterValue
99
99
  import TSparkParameter = ttypes.TSparkParameter
100
+ import TStatementConf = ttypes.TStatementConf
100
101
  import TExecuteStatementResp = ttypes.TExecuteStatementResp
101
102
  import TGetTypeInfoReq = ttypes.TGetTypeInfoReq
102
103
  import TGetTypeInfoResp = ttypes.TGetTypeInfoResp
@@ -141,46 +142,88 @@ declare class Client {
141
142
 
142
143
  constructor(output: thrift.TTransport, pClass: { new(trans: thrift.TTransport): thrift.TProtocol });
143
144
 
145
+ OpenSession(req: TOpenSessionReq): TOpenSessionResp;
146
+
144
147
  OpenSession(req: TOpenSessionReq, callback?: (error: void, response: TOpenSessionResp)=>void): void;
145
148
 
149
+ CloseSession(req: TCloseSessionReq): TCloseSessionResp;
150
+
146
151
  CloseSession(req: TCloseSessionReq, callback?: (error: void, response: TCloseSessionResp)=>void): void;
147
152
 
153
+ GetInfo(req: TGetInfoReq): TGetInfoResp;
154
+
148
155
  GetInfo(req: TGetInfoReq, callback?: (error: void, response: TGetInfoResp)=>void): void;
149
156
 
157
+ ExecuteStatement(req: TExecuteStatementReq): TExecuteStatementResp;
158
+
150
159
  ExecuteStatement(req: TExecuteStatementReq, callback?: (error: void, response: TExecuteStatementResp)=>void): void;
151
160
 
161
+ GetTypeInfo(req: TGetTypeInfoReq): TGetTypeInfoResp;
162
+
152
163
  GetTypeInfo(req: TGetTypeInfoReq, callback?: (error: void, response: TGetTypeInfoResp)=>void): void;
153
164
 
165
+ GetCatalogs(req: TGetCatalogsReq): TGetCatalogsResp;
166
+
154
167
  GetCatalogs(req: TGetCatalogsReq, callback?: (error: void, response: TGetCatalogsResp)=>void): void;
155
168
 
169
+ GetSchemas(req: TGetSchemasReq): TGetSchemasResp;
170
+
156
171
  GetSchemas(req: TGetSchemasReq, callback?: (error: void, response: TGetSchemasResp)=>void): void;
157
172
 
173
+ GetTables(req: TGetTablesReq): TGetTablesResp;
174
+
158
175
  GetTables(req: TGetTablesReq, callback?: (error: void, response: TGetTablesResp)=>void): void;
159
176
 
177
+ GetTableTypes(req: TGetTableTypesReq): TGetTableTypesResp;
178
+
160
179
  GetTableTypes(req: TGetTableTypesReq, callback?: (error: void, response: TGetTableTypesResp)=>void): void;
161
180
 
181
+ GetColumns(req: TGetColumnsReq): TGetColumnsResp;
182
+
162
183
  GetColumns(req: TGetColumnsReq, callback?: (error: void, response: TGetColumnsResp)=>void): void;
163
184
 
185
+ GetFunctions(req: TGetFunctionsReq): TGetFunctionsResp;
186
+
164
187
  GetFunctions(req: TGetFunctionsReq, callback?: (error: void, response: TGetFunctionsResp)=>void): void;
165
188
 
189
+ GetPrimaryKeys(req: TGetPrimaryKeysReq): TGetPrimaryKeysResp;
190
+
166
191
  GetPrimaryKeys(req: TGetPrimaryKeysReq, callback?: (error: void, response: TGetPrimaryKeysResp)=>void): void;
167
192
 
193
+ GetCrossReference(req: TGetCrossReferenceReq): TGetCrossReferenceResp;
194
+
168
195
  GetCrossReference(req: TGetCrossReferenceReq, callback?: (error: void, response: TGetCrossReferenceResp)=>void): void;
169
196
 
197
+ GetOperationStatus(req: TGetOperationStatusReq): TGetOperationStatusResp;
198
+
170
199
  GetOperationStatus(req: TGetOperationStatusReq, callback?: (error: void, response: TGetOperationStatusResp)=>void): void;
171
200
 
201
+ CancelOperation(req: TCancelOperationReq): TCancelOperationResp;
202
+
172
203
  CancelOperation(req: TCancelOperationReq, callback?: (error: void, response: TCancelOperationResp)=>void): void;
173
204
 
205
+ CloseOperation(req: TCloseOperationReq): TCloseOperationResp;
206
+
174
207
  CloseOperation(req: TCloseOperationReq, callback?: (error: void, response: TCloseOperationResp)=>void): void;
175
208
 
209
+ GetResultSetMetadata(req: TGetResultSetMetadataReq): TGetResultSetMetadataResp;
210
+
176
211
  GetResultSetMetadata(req: TGetResultSetMetadataReq, callback?: (error: void, response: TGetResultSetMetadataResp)=>void): void;
177
212
 
213
+ FetchResults(req: TFetchResultsReq): TFetchResultsResp;
214
+
178
215
  FetchResults(req: TFetchResultsReq, callback?: (error: void, response: TFetchResultsResp)=>void): void;
179
216
 
217
+ GetDelegationToken(req: TGetDelegationTokenReq): TGetDelegationTokenResp;
218
+
180
219
  GetDelegationToken(req: TGetDelegationTokenReq, callback?: (error: void, response: TGetDelegationTokenResp)=>void): void;
181
220
 
221
+ CancelDelegationToken(req: TCancelDelegationTokenReq): TCancelDelegationTokenResp;
222
+
182
223
  CancelDelegationToken(req: TCancelDelegationTokenReq, callback?: (error: void, response: TCancelDelegationTokenResp)=>void): void;
183
224
 
225
+ RenewDelegationToken(req: TRenewDelegationTokenReq): TRenewDelegationTokenResp;
226
+
184
227
  RenewDelegationToken(req: TRenewDelegationTokenReq, callback?: (error: void, response: TRenewDelegationTokenResp)=>void): void;
185
228
  }
186
229
 
@@ -469,8 +469,9 @@ declare class TSparkArrowResultLink {
469
469
  public startRowOffset: Int64;
470
470
  public rowCount: Int64;
471
471
  public bytesNum: Int64;
472
+ public httpHeaders?: { [k: string]: string; };
472
473
 
473
- constructor(args?: { fileLink: string; expiryTime: Int64; startRowOffset: Int64; rowCount: Int64; bytesNum: Int64; });
474
+ constructor(args?: { fileLink: string; expiryTime: Int64; startRowOffset: Int64; rowCount: Int64; bytesNum: Int64; httpHeaders?: { [k: string]: string; }; });
474
475
  }
475
476
 
476
477
  declare class TDBSqlCloudResultFile {
@@ -481,8 +482,9 @@ declare class TDBSqlCloudResultFile {
481
482
  public compressedBytes?: Int64;
482
483
  public fileLink?: string;
483
484
  public linkExpiryTime?: Int64;
485
+ public httpHeaders?: { [k: string]: string; };
484
486
 
485
- constructor(args?: { filePath?: string; startRowOffset?: Int64; rowCount?: Int64; uncompressedBytes?: Int64; compressedBytes?: Int64; fileLink?: string; linkExpiryTime?: Int64; });
487
+ constructor(args?: { filePath?: string; startRowOffset?: Int64; rowCount?: Int64; uncompressedBytes?: Int64; compressedBytes?: Int64; fileLink?: string; linkExpiryTime?: Int64; httpHeaders?: { [k: string]: string; }; });
486
488
  }
487
489
 
488
490
  declare class TRowSet {
@@ -555,9 +557,10 @@ declare class TStatus {
555
557
  public errorCode?: number;
556
558
  public errorMessage?: string;
557
559
  public displayMessage?: string;
560
+ public errorDetailsJson?: string;
558
561
  public responseValidation?: Buffer;
559
562
 
560
- constructor(args?: { statusCode: TStatusCode; infoMessages?: string[]; sqlState?: string; errorCode?: number; errorMessage?: string; displayMessage?: string; responseValidation?: Buffer; });
563
+ constructor(args?: { statusCode: TStatusCode; infoMessages?: string[]; sqlState?: string; errorCode?: number; errorMessage?: string; displayMessage?: string; errorDetailsJson?: string; responseValidation?: Buffer; });
561
564
  }
562
565
 
563
566
  declare class TNamespace {
@@ -696,6 +699,8 @@ declare class TExecuteStatementReq {
696
699
  public useArrowNativeTypes?: TSparkArrowTypes;
697
700
  public resultRowLimit?: Int64;
698
701
  public parameters?: TSparkParameter[];
702
+ public maxBytesPerBatch?: Int64;
703
+ public statementConf?: TStatementConf;
699
704
  public operationId?: THandleIdentifier;
700
705
  public sessionConf?: TDBSqlSessionConf;
701
706
  public rejectHighCostQueries?: boolean;
@@ -712,8 +717,12 @@ declare class TExecuteStatementReq {
712
717
  public resultByteLimit?: Int64;
713
718
  public resultDataFormat?: TDBSqlResultFormat;
714
719
  public originatingClientIdentity?: string;
720
+ public preferSingleFileResult?: boolean;
721
+ public preferDriverOnlyUpload?: boolean;
722
+ public enforceEmbeddedSchemaCorrectness?: boolean;
723
+ public idempotencyToken?: string;
715
724
 
716
- constructor(args?: { sessionHandle: TSessionHandle; statement: string; confOverlay?: { [k: string]: string; }; runAsync?: boolean; getDirectResults?: TSparkGetDirectResults; queryTimeout?: Int64; canReadArrowResult?: boolean; canDownloadResult?: boolean; canDecompressLZ4Result?: boolean; maxBytesPerFile?: Int64; useArrowNativeTypes?: TSparkArrowTypes; resultRowLimit?: Int64; parameters?: TSparkParameter[]; operationId?: THandleIdentifier; sessionConf?: TDBSqlSessionConf; rejectHighCostQueries?: boolean; estimatedCost?: number; executionVersion?: number; requestValidation?: Buffer; resultPersistenceMode?: TResultPersistenceMode; trimArrowBatchesToLimit?: boolean; fetchDisposition?: TDBSqlFetchDisposition; enforceResultPersistenceMode?: boolean; statementList?: TDBSqlStatement[]; persistResultManifest?: boolean; resultRetentionSeconds?: Int64; resultByteLimit?: Int64; resultDataFormat?: TDBSqlResultFormat; originatingClientIdentity?: string; });
725
+ constructor(args?: { sessionHandle: TSessionHandle; statement: string; confOverlay?: { [k: string]: string; }; runAsync?: boolean; getDirectResults?: TSparkGetDirectResults; queryTimeout?: Int64; canReadArrowResult?: boolean; canDownloadResult?: boolean; canDecompressLZ4Result?: boolean; maxBytesPerFile?: Int64; useArrowNativeTypes?: TSparkArrowTypes; resultRowLimit?: Int64; parameters?: TSparkParameter[]; maxBytesPerBatch?: Int64; statementConf?: TStatementConf; operationId?: THandleIdentifier; sessionConf?: TDBSqlSessionConf; rejectHighCostQueries?: boolean; estimatedCost?: number; executionVersion?: number; requestValidation?: Buffer; resultPersistenceMode?: TResultPersistenceMode; trimArrowBatchesToLimit?: boolean; fetchDisposition?: TDBSqlFetchDisposition; enforceResultPersistenceMode?: boolean; statementList?: TDBSqlStatement[]; persistResultManifest?: boolean; resultRetentionSeconds?: Int64; resultByteLimit?: Int64; resultDataFormat?: TDBSqlResultFormat; originatingClientIdentity?: string; preferSingleFileResult?: boolean; preferDriverOnlyUpload?: boolean; enforceEmbeddedSchemaCorrectness?: boolean; idempotencyToken?: string; });
717
726
  }
718
727
 
719
728
  declare class TDBSqlStatement {
@@ -739,6 +748,15 @@ declare class TSparkParameter {
739
748
  constructor(args?: { ordinal?: number; name?: string; type?: string; value?: TSparkParameterValue; });
740
749
  }
741
750
 
751
+ declare class TStatementConf {
752
+ public sessionless?: boolean;
753
+ public initialNamespace?: TNamespace;
754
+ public client_protocol?: TProtocolVersion;
755
+ public client_protocol_i64?: Int64;
756
+
757
+ constructor(args?: { sessionless?: boolean; initialNamespace?: TNamespace; client_protocol?: TProtocolVersion; client_protocol_i64?: Int64; });
758
+ }
759
+
742
760
  declare class TExecuteStatementResp {
743
761
  public status: TStatus;
744
762
  public operationHandle?: TOperationHandle;
@@ -961,12 +979,13 @@ declare class TGetOperationStatusResp {
961
979
  public numModifiedRows?: Int64;
962
980
  public displayMessage?: string;
963
981
  public diagnosticInfo?: string;
982
+ public errorDetailsJson?: string;
964
983
  public responseValidation?: Buffer;
965
984
  public idempotencyType?: TOperationIdempotencyType;
966
985
  public statementTimeout?: Int64;
967
986
  public statementTimeoutLevel?: TOperationTimeoutLevel;
968
987
 
969
- constructor(args?: { status: TStatus; operationState?: TOperationState; sqlState?: string; errorCode?: number; errorMessage?: string; taskStatus?: string; operationStarted?: Int64; operationCompleted?: Int64; hasResultSet?: boolean; progressUpdateResponse?: TProgressUpdateResp; numModifiedRows?: Int64; displayMessage?: string; diagnosticInfo?: string; responseValidation?: Buffer; idempotencyType?: TOperationIdempotencyType; statementTimeout?: Int64; statementTimeoutLevel?: TOperationTimeoutLevel; });
988
+ constructor(args?: { status: TStatus; operationState?: TOperationState; sqlState?: string; errorCode?: number; errorMessage?: string; taskStatus?: string; operationStarted?: Int64; operationCompleted?: Int64; hasResultSet?: boolean; progressUpdateResponse?: TProgressUpdateResp; numModifiedRows?: Int64; displayMessage?: string; diagnosticInfo?: string; errorDetailsJson?: string; responseValidation?: Buffer; idempotencyType?: TOperationIdempotencyType; statementTimeout?: Int64; statementTimeoutLevel?: TOperationTimeoutLevel; });
970
989
  }
971
990
 
972
991
  declare class TCancelOperationReq {
@@ -1023,8 +1042,9 @@ declare class TGetResultSetMetadataResp {
1023
1042
  public isServerless?: boolean;
1024
1043
  public resultDataFormat?: TDBSqlResultFormat;
1025
1044
  public truncatedByThriftLimit?: boolean;
1045
+ public resultByteLimit?: Int64;
1026
1046
 
1027
- constructor(args?: { status: TStatus; schema?: TTableSchema; resultFormat?: TSparkRowSetType; lz4Compressed?: boolean; arrowSchema?: Buffer; cacheLookupResult?: TCacheLookupResult; uncompressedBytes?: Int64; compressedBytes?: Int64; isStagingOperation?: boolean; reasonForNoCloudFetch?: TCloudFetchDisabledReason; resultFiles?: TDBSqlCloudResultFile[]; manifestFile?: string; manifestFileFormat?: TDBSqlManifestFileFormat; cacheLookupLatency?: Int64; remoteCacheMissReason?: string; fetchDisposition?: TDBSqlFetchDisposition; remoteResultCacheEnabled?: boolean; isServerless?: boolean; resultDataFormat?: TDBSqlResultFormat; truncatedByThriftLimit?: boolean; });
1047
+ constructor(args?: { status: TStatus; schema?: TTableSchema; resultFormat?: TSparkRowSetType; lz4Compressed?: boolean; arrowSchema?: Buffer; cacheLookupResult?: TCacheLookupResult; uncompressedBytes?: Int64; compressedBytes?: Int64; isStagingOperation?: boolean; reasonForNoCloudFetch?: TCloudFetchDisabledReason; resultFiles?: TDBSqlCloudResultFile[]; manifestFile?: string; manifestFileFormat?: TDBSqlManifestFileFormat; cacheLookupLatency?: Int64; remoteCacheMissReason?: string; fetchDisposition?: TDBSqlFetchDisposition; remoteResultCacheEnabled?: boolean; isServerless?: boolean; resultDataFormat?: TDBSqlResultFormat; truncatedByThriftLimit?: boolean; resultByteLimit?: Int64; });
1028
1048
  }
1029
1049
 
1030
1050
  declare class TFetchResultsReq {