1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import * as common from '@google-cloud/common';
|
18 | import { ResourceStream } from '@google-cloud/paginator';
|
19 | import { BigQuery, Job, Dataset, Query, SimpleQueryRowsResponse, SimpleQueryRowsCallback, ResourceCallback, RequestCallback, PagedResponse, PagedCallback, JobRequest, PagedRequest } from '.';
|
20 | import { Duplex, Writable } from 'stream';
|
21 | import { JobMetadata } from './job';
|
22 | import bigquery from './types';
|
23 | import { IntegerTypeCastOptions } from './bigquery';
|
24 | export interface File {
|
25 | bucket: any;
|
26 | kmsKeyName?: string;
|
27 | userProject?: string;
|
28 | name: string;
|
29 | generation?: number;
|
30 | }
|
31 | export declare type JobMetadataCallback = RequestCallback<JobMetadata>;
|
32 | export declare type JobMetadataResponse = [JobMetadata];
|
33 | export declare type RowMetadata = any;
|
34 | export declare type InsertRowsOptions = bigquery.ITableDataInsertAllRequest & {
|
35 | createInsertId?: boolean;
|
36 | partialRetries?: number;
|
37 | raw?: boolean;
|
38 | schema?: string | {};
|
39 | };
|
40 | export declare type InsertRowsResponse = [bigquery.ITableDataInsertAllResponse | bigquery.ITable];
|
41 | export declare type InsertRowsCallback = RequestCallback<bigquery.ITableDataInsertAllResponse | bigquery.ITable>;
|
42 | export declare type RowsResponse = PagedResponse<RowMetadata, GetRowsOptions, bigquery.ITableDataList | bigquery.ITable>;
|
43 | export declare type RowsCallback = PagedCallback<RowMetadata, GetRowsOptions, bigquery.ITableDataList | bigquery.ITable>;
|
44 | export interface InsertRow {
|
45 | insertId?: string;
|
46 | json?: bigquery.IJsonObject;
|
47 | }
|
48 | export declare type TableRow = bigquery.ITableRow;
|
49 | export declare type TableRowField = bigquery.ITableCell;
|
50 | export declare type TableRowValue = string | TableRow;
|
51 | export declare type GetRowsOptions = PagedRequest<bigquery.tabledata.IListParams> & {
|
52 | wrapIntegers?: boolean | IntegerTypeCastOptions;
|
53 | };
|
54 | export declare type JobLoadMetadata = JobRequest<bigquery.IJobConfigurationLoad> & {
|
55 | format?: string;
|
56 | };
|
57 | export declare type CreateExtractJobOptions = JobRequest<bigquery.IJobConfigurationExtract> & {
|
58 | format?: 'CSV' | 'JSON' | 'AVRO' | 'PARQUET' | 'ORC';
|
59 | gzip?: boolean;
|
60 | };
|
61 | export declare type JobResponse = [Job, bigquery.IJob];
|
62 | export declare type JobCallback = ResourceCallback<Job, bigquery.IJob>;
|
63 | export declare type CreateCopyJobMetadata = CopyTableMetadata;
|
64 | export declare type SetTableMetadataOptions = TableMetadata;
|
65 | export declare type CopyTableMetadata = JobRequest<bigquery.IJobConfigurationTableCopy>;
|
66 | export declare type TableMetadata = bigquery.ITable & {
|
67 | name?: string;
|
68 | schema?: string | TableField[] | TableSchema;
|
69 | partitioning?: string;
|
70 | view?: string | ViewDefinition;
|
71 | };
|
72 | export declare type ViewDefinition = bigquery.IViewDefinition;
|
73 | export declare type FormattedMetadata = bigquery.ITable;
|
74 | export declare type TableSchema = bigquery.ITableSchema;
|
75 | export declare type TableField = bigquery.ITableFieldSchema;
|
76 | export interface PartialInsertFailure {
|
77 | message: string;
|
78 | reason: string;
|
79 | row: RowMetadata;
|
80 | }
|
81 | export declare type Policy = bigquery.IPolicy;
|
82 | export declare type GetPolicyOptions = bigquery.IGetPolicyOptions;
|
83 | export declare type SetPolicyOptions = Omit<bigquery.ISetIamPolicyRequest, 'policy'>;
|
84 | export declare type PolicyRequest = bigquery.IGetIamPolicyRequest;
|
85 | export declare type PolicyResponse = [Policy];
|
86 | export declare type PolicyCallback = RequestCallback<PolicyResponse>;
|
87 | export declare type PermissionsResponse = [bigquery.ITestIamPermissionsResponse];
|
88 | export declare type PermissionsCallback = RequestCallback<PermissionsResponse>;
|
89 | export interface TableOptions {
|
90 | location?: string;
|
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 | declare class Table extends common.ServiceObject {
|
116 | dataset: Dataset;
|
117 | bigQuery: BigQuery;
|
118 | location?: string;
|
119 | createReadStream: (options?: GetRowsOptions) => ResourceStream<RowMetadata>;
|
120 | constructor(dataset: Dataset, id: string, options?: TableOptions);
|
121 | /**
|
122 | * Convert a comma-separated name:type string to a table schema object.
|
123 | *
|
124 | * @static
|
125 | * @private
|
126 | *
|
127 | * @param {string} str Comma-separated schema string.
|
128 | * @returns {object} Table schema in the format the API expects.
|
129 | */
|
130 | static createSchemaFromString_(str: string): TableSchema;
|
131 | |
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | static encodeValue_(value?: {} | null): {} | null;
|
142 | |
143 |
|
144 |
|
145 | static formatMetadata_(options: TableMetadata): FormattedMetadata;
|
146 | copy(destination: Table, metadata?: CopyTableMetadata): Promise<JobMetadataResponse>;
|
147 | copy(destination: Table, metadata: CopyTableMetadata, callback: JobMetadataCallback): void;
|
148 | copy(destination: Table, callback: JobMetadataCallback): void;
|
149 | copyFrom(sourceTables: Table | Table[], metadata?: CopyTableMetadata): Promise<JobMetadataResponse>;
|
150 | copyFrom(sourceTables: Table | Table[], metadata: CopyTableMetadata, callback: JobMetadataCallback): void;
|
151 | copyFrom(sourceTables: Table | Table[], callback: JobMetadataCallback): void;
|
152 | createCopyJob(destination: Table, metadata?: CreateCopyJobMetadata): Promise<JobResponse>;
|
153 | createCopyJob(destination: Table, metadata: CreateCopyJobMetadata, callback: JobCallback): void;
|
154 | createCopyJob(destination: Table, callback: JobCallback): void;
|
155 | createCopyFromJob(source: Table | Table[], metadata?: CopyTableMetadata): Promise<JobResponse>;
|
156 | createCopyFromJob(source: Table | Table[], metadata: CopyTableMetadata, callback: JobCallback): void;
|
157 | createCopyFromJob(source: Table | Table[], callback: JobCallback): void;
|
158 | createExtractJob(destination: File, options?: CreateExtractJobOptions): Promise<JobResponse>;
|
159 | createExtractJob(destination: File, options: CreateExtractJobOptions, callback: JobCallback): void;
|
160 | createExtractJob(destination: File, callback: JobCallback): void;
|
161 | createLoadJob(source: string | File, metadata?: JobLoadMetadata): Promise<JobResponse>;
|
162 | createLoadJob(source: string | File, metadata: JobLoadMetadata, callback: JobCallback): void;
|
163 | createLoadJob(source: string | File, callback: JobCallback): void;
|
164 | |
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | _createLoadJob(source: string | File | File[], metadata: JobLoadMetadata): Promise<JobResponse>;
|
171 | createQueryJob(options: Query): Promise<JobResponse>;
|
172 | createQueryJob(options: Query, callback: JobCallback): void;
|
173 | |
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 | createQueryStream(query: Query): Duplex;
|
185 | |
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | createWriteStream_(metadata: JobLoadMetadata | string): Writable;
|
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 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 | createWriteStream(metadata: JobLoadMetadata | string): Writable;
|
262 | extract(destination: File, options?: CreateExtractJobOptions): Promise<JobMetadataResponse>;
|
263 | extract(destination: File, options: CreateExtractJobOptions, callback?: JobMetadataCallback): void;
|
264 | extract(destination: File, callback?: JobMetadataCallback): void;
|
265 | getRows(options?: GetRowsOptions): Promise<RowsResponse>;
|
266 | getRows(options: GetRowsOptions, callback: RowsCallback): void;
|
267 | getRows(callback: RowsCallback): void;
|
268 | insert(rows: RowMetadata | RowMetadata[], options?: InsertRowsOptions): Promise<InsertRowsResponse>;
|
269 | insert(rows: RowMetadata | RowMetadata[], options: InsertRowsOptions, callback: InsertRowsCallback): void;
|
270 | insert(rows: RowMetadata | RowMetadata[], callback: InsertRowsCallback): void;
|
271 | |
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | private _insertAndCreateTable;
|
280 | |
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 | private _insertWithRetry;
|
292 | |
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | private _insert;
|
303 | load(source: string | File, metadata?: JobLoadMetadata): Promise<JobMetadataResponse>;
|
304 | load(source: string | File, metadata: JobLoadMetadata, callback: JobMetadataCallback): void;
|
305 | load(source: string | File, callback: JobMetadataCallback): void;
|
306 | query(query: Query): Promise<SimpleQueryRowsResponse>;
|
307 | query(query: string): Promise<SimpleQueryRowsResponse>;
|
308 | query(query: Query, callback: SimpleQueryRowsCallback): void;
|
309 | setMetadata(metadata: SetTableMetadataOptions): Promise<common.SetMetadataResponse>;
|
310 | setMetadata(metadata: SetTableMetadataOptions, callback: common.ResponseCallback): void;
|
311 | getIamPolicy(optionsOrCallback?: GetPolicyOptions | PolicyCallback): Promise<PolicyResponse>;
|
312 | getIamPolicy(options: GetPolicyOptions, callback: PolicyCallback): void;
|
313 | setIamPolicy(policy: Policy, options?: SetPolicyOptions): Promise<PolicyResponse>;
|
314 | setIamPolicy(policy: Policy, options: SetPolicyOptions, callback: PolicyCallback): void;
|
315 | setIamPolicy(policy: Policy, callback: PolicyCallback): void;
|
316 | testIamPermissions(permissions: string | string[]): Promise<PermissionsResponse>;
|
317 | testIamPermissions(permissions: string | string[], callback: PermissionsCallback): void;
|
318 | }
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | export { Table };
|