-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathIDBSQLSession.ts
More file actions
236 lines (213 loc) · 6.45 KB
/
Copy pathIDBSQLSession.ts
File metadata and controls
236 lines (213 loc) · 6.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
import Int64 from 'node-int64';
import IOperation from './IOperation';
import Status from '../dto/Status';
import InfoValue from '../dto/InfoValue';
import { DBSQLParameter, DBSQLParameterValue } from '../DBSQLParameter';
export type ExecuteStatementOptions = {
/**
* The number of seconds after which the query will time out on the server.
* Effective only with Compute clusters. For SQL Warehouses, `STATEMENT_TIMEOUT`
* configuration should be used
*/
queryTimeout?: number | bigint | Int64;
/**
* Selects the execution lifecycle. The only observable effect is WHEN
* `executeStatement` resolves; the result data, schema, and error classes are
* identical regardless.
*
* - **Thrift backend:** no-op. The Thrift path always submits asynchronously
* (`runAsync: true` on the wire) and polls during fetch; this option is not
* read.
* - **Kernel backend (`useKernel`):** selects the kernel execution path —
* `false`/unset (default) runs the blocking direct-results path (faster,
* cancellable mid-compute); `true` submits and polls (returns a pending
* handle before completion). Default is sync, matching the python
* connector's `cursor.execute()`.
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
useCloudFetch?: boolean;
useLZ4Compression?: boolean;
stagingAllowedLocalPath?: string | string[];
namedParameters?: Record<string, DBSQLParameter | DBSQLParameterValue>;
ordinalParameters?: Array<DBSQLParameter | DBSQLParameterValue>;
/**
* Per-statement query tags as key-value pairs. Serialized and passed via confOverlay
* as "query_tags". Values may be null/undefined to include a key without a value.
* These tags apply only to this statement and do not persist across queries.
*/
queryTags?: Record<string, string | null | undefined>;
/**
* SEA-only: server-side row cap for this statement (kernel `row_limit`). The
* Thrift backend has no execute-time server cap, so this is a no-op there;
* use `maxRows` for the cross-backend client-side fetch limit.
*/
rowLimit?: number;
/**
* SEA-only: per-statement Spark conf overlay (kernel `statement_conf`).
* Merged with the serialized `queryTags` (which land under the reserved
* `query_tags` key). Ignored by the Thrift backend.
*/
statementConf?: Record<string, string>;
};
export type TypeInfoRequest = {
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type CatalogsRequest = {
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type SchemasRequest = {
catalogName?: string;
schemaName?: string;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type TablesRequest = {
catalogName?: string;
schemaName?: string;
tableName?: string;
tableTypes?: Array<string>;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type TableTypesRequest = {
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type ColumnsRequest = {
catalogName?: string;
schemaName?: string;
tableName?: string;
columnName?: string;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type FunctionsRequest = {
catalogName?: string;
schemaName?: string;
functionName: string;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type PrimaryKeysRequest = {
catalogName?: string;
schemaName: string;
tableName: string;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export type CrossReferenceRequest = {
parentCatalogName: string;
parentSchemaName: string;
parentTableName: string;
foreignCatalogName: string;
foreignSchemaName: string;
foreignTableName: string;
/**
* @deprecated This option is no longer supported and will be removed in future releases
*/
runAsync?: boolean;
maxRows?: number | bigint | Int64 | null;
};
export default interface IDBSQLSession {
/**
* Session identifier
*/
readonly id: string;
/**
* Returns general information about the data source
*
* @param infoType one of the values TCLIService_types.TGetInfoType
*/
getInfo(infoType: number): Promise<InfoValue>;
/**
* Executes DDL/DML statements
*
* @param statement DDL/DML statement
* @param options
*/
executeStatement(statement: string, options?: ExecuteStatementOptions): Promise<IOperation>;
/**
* Information about supported data types
*
* @param request
*/
getTypeInfo(request?: TypeInfoRequest): Promise<IOperation>;
/**
* Get list of catalogs
*
* @param request
*/
getCatalogs(request?: CatalogsRequest): Promise<IOperation>;
/**
* Get list of databases
*
* @param request
*/
getSchemas(request?: SchemasRequest): Promise<IOperation>;
/**
* Get list of tables
*
* @param request
*/
getTables(request?: TablesRequest): Promise<IOperation>;
/**
* Get list of supported table types
*
* @param request
*/
getTableTypes(request?: TableTypesRequest): Promise<IOperation>;
/**
* Get full information about columns of the table
*
* @param request
*/
getColumns(request?: ColumnsRequest): Promise<IOperation>;
/**
* Get information about function
*
* @param request
*/
getFunctions(request: FunctionsRequest): Promise<IOperation>;
/**
* Get primary keys of table
*
* @param request
*/
getPrimaryKeys(request: PrimaryKeysRequest): Promise<IOperation>;
/**
* Request information about foreign keys between two tables
* @param request
*/
getCrossReference(request: CrossReferenceRequest): Promise<IOperation>;
/**
* closes the session
*/
close(): Promise<Status>;
}