blob: 562a7e076c6c82bc90f2f5113e5583d928321ae6 [file] [log] [blame]
John Asmuth614db982014-04-24 15:46:26 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="bigquery_v2.html">BigQuery API</a> . <a href="bigquery_v2.jobs.html">jobs</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#get">get(projectId, jobId)</a></code></p>
79<p class="firstline">Retrieves the specified job by ID.</p>
80<p class="toc_element">
81 <code><a href="#getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</a></code></p>
82<p class="firstline">Retrieves the results of a query job.</p>
83<p class="toc_element">
84 <code><a href="#insert">insert(projectId, body=None, media_body=None)</a></code></p>
85<p class="firstline">Starts a new asynchronous job.</p>
86<p class="toc_element">
87 <code><a href="#list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</a></code></p>
88<p class="firstline">Lists all the Jobs in the specified project that were started by the user.</p>
89<p class="toc_element">
90 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
91<p class="firstline">Retrieves the next page of results.</p>
92<p class="toc_element">
93 <code><a href="#query">query(projectId, body)</a></code></p>
94<p class="firstline">Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.</p>
95<h3>Method Details</h3>
96<div class="method">
97 <code class="details" id="get">get(projectId, jobId)</code>
98 <pre>Retrieves the specified job by ID.
99
100Args:
101 projectId: string, Project ID of the requested job (required)
102 jobId: string, Job ID of the requested job (required)
103
104Returns:
105 An object of the form:
106
107 {
108 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
109 "state": "A String", # [Output-only] Running state of the job.
110 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
111 {
112 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
113 "message": "A String", # A human-readable description of the error.
114 "reason": "A String", # A short error code that summarizes the error.
115 "location": "A String", # Specifies where the error occurred, if present.
116 },
117 ],
118 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
119 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
120 "message": "A String", # A human-readable description of the error.
121 "reason": "A String", # A short error code that summarizes the error.
122 "location": "A String", # Specifies where the error occurred, if present.
123 },
124 },
125 "kind": "bigquery#job", # [Output-only] The type of the resource.
126 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
127 "load": { # [Output-only] Statistics for a load job.
128 "outputRows": "A String", # [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
129 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
130 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
131 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while an import job is in the running state, this value may change.
132 },
133 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
134 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
135 "startTime": "A String", # [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
136 "query": { # [Output-only] Statistics for a query job.
137 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
138 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
139 },
140 "endTime": "A String", # [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
141 },
142 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
143 "projectId": "A String", # [Required] Project ID being billed for the job.
144 "jobId": "A String", # [Required] ID of the job.
145 },
146 "etag": "A String", # [Output-only] A hash of this resource.
147 "configuration": { # [Required] Describes the job configuration.
148 "load": { # [Pick one] Configures a load job.
149 "encoding": "A String", # [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
150 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
151 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
152 "destinationTable": { # [Required] The destination table to load the data into.
153 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
154 "tableId": "A String", # [Required] ID of the table.
155 "datasetId": "A String", # [Required] ID of the dataset containing the table.
156 },
157 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
158 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an 'invalid' error is returned in the job result and the job fails. The default value is 0, which requires that all records are valid.
159 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. Default is false which treats short rows as errors. Only applicable to CSV, ignored for other formats.
160 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
161 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data on Google Cloud Storage.
162 "A String",
163 ],
164 "quote": "A String", # [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
165 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
166 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
167 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
168 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
169 "ignoreUnknownValues": True or False, # [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false which treats unknown values as errors. For CSV this ignores extra values at the end of a line. For JSON this ignores named values that do not match any column name.
170 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
171 "fields": [ # Describes the fields in a table.
172 {
173 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
174 # Object with schema name: TableFieldSchema
175 ],
176 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
177 "description": "A String", # [Optional] The field description.
178 "name": "A String", # [Required] The field name.
179 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
180 },
181 ],
182 },
183 },
184 "dryRun": True or False, # [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
185 "link": { # [Pick one] Configures a link job.
186 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
187 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
188 "destinationTable": { # [Required] The destination table of the link job.
189 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
190 "tableId": "A String", # [Required] ID of the table.
191 "datasetId": "A String", # [Required] ID of the dataset containing the table.
192 },
193 "sourceUri": [ # [Required] URI of source table to link.
194 "A String",
195 ],
196 },
197 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700198 "flattenResults": True or False, # [Experimental] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
John Asmuth614db982014-04-24 15:46:26 -0400199 "useQueryCache": True or False, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified.
200 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
201 "projectId": "A String", # [Optional] The ID of the container project.
202 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
203 },
204 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
205 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
206 "tableId": "A String", # [Required] ID of the table.
207 "datasetId": "A String", # [Required] ID of the dataset containing the table.
208 },
209 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
210 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700211 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400212 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
213 "query": "A String", # [Required] BigQuery SQL query to execute.
214 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
215 },
216 "copy": { # [Pick one] Copies a table.
217 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700218 "sourceTables": [ # [Pick one] Source tables to copy.
219 {
220 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
221 "tableId": "A String", # [Required] ID of the table.
222 "datasetId": "A String", # [Required] ID of the dataset containing the table.
223 },
224 ],
John Asmuth614db982014-04-24 15:46:26 -0400225 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
226 "destinationTable": { # [Required] The destination table
227 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
228 "tableId": "A String", # [Required] ID of the table.
229 "datasetId": "A String", # [Required] ID of the dataset containing the table.
230 },
Craig Citro065b5302014-08-14 00:47:23 -0700231 "sourceTable": { # [Pick one] Source table to copy.
John Asmuth614db982014-04-24 15:46:26 -0400232 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
233 "tableId": "A String", # [Required] ID of the table.
234 "datasetId": "A String", # [Required] ID of the dataset containing the table.
235 },
236 },
237 "extract": { # [Pick one] Configures an extract job.
238 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700239 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400240 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700241 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
John Asmuth614db982014-04-24 15:46:26 -0400242 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
243 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
244 "A String",
245 ],
246 "sourceTable": { # [Required] A reference to the table being exported.
247 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
248 "tableId": "A String", # [Required] ID of the table.
249 "datasetId": "A String", # [Required] ID of the dataset containing the table.
250 },
251 },
252 },
253 "id": "A String", # [Output-only] Opaque ID field of the job
254 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
255 }</pre>
256</div>
257
258<div class="method">
259 <code class="details" id="getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</code>
260 <pre>Retrieves the results of a query job.
261
262Args:
263 projectId: string, Project ID of the query job (required)
264 jobId: string, Job ID of the query job (required)
265 timeoutMs: integer, How long to wait for the query to complete, in milliseconds, before returning. Default is to return immediately. If the timeout passes before the job completes, the request will fail with a TIMEOUT error
266 pageToken: string, Page token, returned by a previous call, to request the next page of results
267 maxResults: integer, Maximum number of results to read
268 startIndex: string, Zero-based index of the starting row
269
270Returns:
271 An object of the form:
272
273 {
274 "kind": "bigquery#getQueryResultsResponse", # The resource type of the response.
275 "rows": [ # An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above. Present only when the query completes successfully.
276 { # Represents a single row in the result set, consisting of one or more fields.
277 "f": [
278 { # Represents a single cell in the result set. Users of the java client can detect whether their value result is null by calling 'com.google.api.client.util.Data.isNull(cell.getV())'.
279 "v": "",
280 },
281 ],
282 },
283 ],
284 "jobReference": { # Reference to the BigQuery Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults).
285 "projectId": "A String", # [Required] Project ID being billed for the job.
286 "jobId": "A String", # [Required] ID of the job.
287 },
288 "pageToken": "A String", # A token used for paging results.
289 "jobComplete": True or False, # Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.
290 "totalRows": "A String", # The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results. Present only when the query completes successfully.
291 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
292 "etag": "A String", # A hash of this response.
293 "schema": { # The schema of the results. Present only when the query completes successfully.
294 "fields": [ # Describes the fields in a table.
295 {
296 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
297 # Object with schema name: TableFieldSchema
298 ],
299 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
300 "description": "A String", # [Optional] The field description.
301 "name": "A String", # [Required] The field name.
302 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
303 },
304 ],
305 },
306 }</pre>
307</div>
308
309<div class="method">
310 <code class="details" id="insert">insert(projectId, body=None, media_body=None)</code>
311 <pre>Starts a new asynchronous job.
312
313Args:
314 projectId: string, Project ID of the project that will be billed for the job (required)
315 body: object, The request body.
316 The object takes the form of:
317
318{
319 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
320 "state": "A String", # [Output-only] Running state of the job.
321 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
322 {
323 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
324 "message": "A String", # A human-readable description of the error.
325 "reason": "A String", # A short error code that summarizes the error.
326 "location": "A String", # Specifies where the error occurred, if present.
327 },
328 ],
329 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
330 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
331 "message": "A String", # A human-readable description of the error.
332 "reason": "A String", # A short error code that summarizes the error.
333 "location": "A String", # Specifies where the error occurred, if present.
334 },
335 },
336 "kind": "bigquery#job", # [Output-only] The type of the resource.
337 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
338 "load": { # [Output-only] Statistics for a load job.
339 "outputRows": "A String", # [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
340 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
341 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
342 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while an import job is in the running state, this value may change.
343 },
344 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
345 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
346 "startTime": "A String", # [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
347 "query": { # [Output-only] Statistics for a query job.
348 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
349 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
350 },
351 "endTime": "A String", # [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
352 },
353 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
354 "projectId": "A String", # [Required] Project ID being billed for the job.
355 "jobId": "A String", # [Required] ID of the job.
356 },
357 "etag": "A String", # [Output-only] A hash of this resource.
358 "configuration": { # [Required] Describes the job configuration.
359 "load": { # [Pick one] Configures a load job.
360 "encoding": "A String", # [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
361 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
362 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
363 "destinationTable": { # [Required] The destination table to load the data into.
364 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
365 "tableId": "A String", # [Required] ID of the table.
366 "datasetId": "A String", # [Required] ID of the dataset containing the table.
367 },
368 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
369 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an 'invalid' error is returned in the job result and the job fails. The default value is 0, which requires that all records are valid.
370 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. Default is false which treats short rows as errors. Only applicable to CSV, ignored for other formats.
371 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
372 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data on Google Cloud Storage.
373 "A String",
374 ],
375 "quote": "A String", # [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
376 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
377 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
378 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
379 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
380 "ignoreUnknownValues": True or False, # [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false which treats unknown values as errors. For CSV this ignores extra values at the end of a line. For JSON this ignores named values that do not match any column name.
381 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
382 "fields": [ # Describes the fields in a table.
383 {
384 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
385 # Object with schema name: TableFieldSchema
386 ],
387 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
388 "description": "A String", # [Optional] The field description.
389 "name": "A String", # [Required] The field name.
390 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
391 },
392 ],
393 },
394 },
395 "dryRun": True or False, # [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
396 "link": { # [Pick one] Configures a link job.
397 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
398 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
399 "destinationTable": { # [Required] The destination table of the link job.
400 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
401 "tableId": "A String", # [Required] ID of the table.
402 "datasetId": "A String", # [Required] ID of the dataset containing the table.
403 },
404 "sourceUri": [ # [Required] URI of source table to link.
405 "A String",
406 ],
407 },
408 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700409 "flattenResults": True or False, # [Experimental] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
John Asmuth614db982014-04-24 15:46:26 -0400410 "useQueryCache": True or False, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified.
411 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
412 "projectId": "A String", # [Optional] The ID of the container project.
413 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
414 },
415 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
416 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
417 "tableId": "A String", # [Required] ID of the table.
418 "datasetId": "A String", # [Required] ID of the dataset containing the table.
419 },
420 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
421 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700422 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400423 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
424 "query": "A String", # [Required] BigQuery SQL query to execute.
425 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
426 },
427 "copy": { # [Pick one] Copies a table.
428 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700429 "sourceTables": [ # [Pick one] Source tables to copy.
430 {
431 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
432 "tableId": "A String", # [Required] ID of the table.
433 "datasetId": "A String", # [Required] ID of the dataset containing the table.
434 },
435 ],
John Asmuth614db982014-04-24 15:46:26 -0400436 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
437 "destinationTable": { # [Required] The destination table
438 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
439 "tableId": "A String", # [Required] ID of the table.
440 "datasetId": "A String", # [Required] ID of the dataset containing the table.
441 },
Craig Citro065b5302014-08-14 00:47:23 -0700442 "sourceTable": { # [Pick one] Source table to copy.
John Asmuth614db982014-04-24 15:46:26 -0400443 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
444 "tableId": "A String", # [Required] ID of the table.
445 "datasetId": "A String", # [Required] ID of the dataset containing the table.
446 },
447 },
448 "extract": { # [Pick one] Configures an extract job.
449 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700450 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400451 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700452 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
John Asmuth614db982014-04-24 15:46:26 -0400453 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
454 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
455 "A String",
456 ],
457 "sourceTable": { # [Required] A reference to the table being exported.
458 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
459 "tableId": "A String", # [Required] ID of the table.
460 "datasetId": "A String", # [Required] ID of the dataset containing the table.
461 },
462 },
463 },
464 "id": "A String", # [Output-only] Opaque ID field of the job
465 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
466 }
467
468 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
469
470Returns:
471 An object of the form:
472
473 {
474 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
475 "state": "A String", # [Output-only] Running state of the job.
476 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
477 {
478 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
479 "message": "A String", # A human-readable description of the error.
480 "reason": "A String", # A short error code that summarizes the error.
481 "location": "A String", # Specifies where the error occurred, if present.
482 },
483 ],
484 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
485 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
486 "message": "A String", # A human-readable description of the error.
487 "reason": "A String", # A short error code that summarizes the error.
488 "location": "A String", # Specifies where the error occurred, if present.
489 },
490 },
491 "kind": "bigquery#job", # [Output-only] The type of the resource.
492 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
493 "load": { # [Output-only] Statistics for a load job.
494 "outputRows": "A String", # [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
495 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
496 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
497 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while an import job is in the running state, this value may change.
498 },
499 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
500 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
501 "startTime": "A String", # [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
502 "query": { # [Output-only] Statistics for a query job.
503 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
504 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
505 },
506 "endTime": "A String", # [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
507 },
508 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
509 "projectId": "A String", # [Required] Project ID being billed for the job.
510 "jobId": "A String", # [Required] ID of the job.
511 },
512 "etag": "A String", # [Output-only] A hash of this resource.
513 "configuration": { # [Required] Describes the job configuration.
514 "load": { # [Pick one] Configures a load job.
515 "encoding": "A String", # [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
516 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
517 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
518 "destinationTable": { # [Required] The destination table to load the data into.
519 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
520 "tableId": "A String", # [Required] ID of the table.
521 "datasetId": "A String", # [Required] ID of the dataset containing the table.
522 },
523 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
524 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an 'invalid' error is returned in the job result and the job fails. The default value is 0, which requires that all records are valid.
525 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. Default is false which treats short rows as errors. Only applicable to CSV, ignored for other formats.
526 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
527 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data on Google Cloud Storage.
528 "A String",
529 ],
530 "quote": "A String", # [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
531 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
532 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
533 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
534 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
535 "ignoreUnknownValues": True or False, # [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false which treats unknown values as errors. For CSV this ignores extra values at the end of a line. For JSON this ignores named values that do not match any column name.
536 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
537 "fields": [ # Describes the fields in a table.
538 {
539 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
540 # Object with schema name: TableFieldSchema
541 ],
542 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
543 "description": "A String", # [Optional] The field description.
544 "name": "A String", # [Required] The field name.
545 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
546 },
547 ],
548 },
549 },
550 "dryRun": True or False, # [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
551 "link": { # [Pick one] Configures a link job.
552 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
553 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
554 "destinationTable": { # [Required] The destination table of the link job.
555 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
556 "tableId": "A String", # [Required] ID of the table.
557 "datasetId": "A String", # [Required] ID of the dataset containing the table.
558 },
559 "sourceUri": [ # [Required] URI of source table to link.
560 "A String",
561 ],
562 },
563 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700564 "flattenResults": True or False, # [Experimental] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
John Asmuth614db982014-04-24 15:46:26 -0400565 "useQueryCache": True or False, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified.
566 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
567 "projectId": "A String", # [Optional] The ID of the container project.
568 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
569 },
570 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
571 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
572 "tableId": "A String", # [Required] ID of the table.
573 "datasetId": "A String", # [Required] ID of the dataset containing the table.
574 },
575 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
576 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700577 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400578 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
579 "query": "A String", # [Required] BigQuery SQL query to execute.
580 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
581 },
582 "copy": { # [Pick one] Copies a table.
583 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700584 "sourceTables": [ # [Pick one] Source tables to copy.
585 {
586 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
587 "tableId": "A String", # [Required] ID of the table.
588 "datasetId": "A String", # [Required] ID of the dataset containing the table.
589 },
590 ],
John Asmuth614db982014-04-24 15:46:26 -0400591 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
592 "destinationTable": { # [Required] The destination table
593 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
594 "tableId": "A String", # [Required] ID of the table.
595 "datasetId": "A String", # [Required] ID of the dataset containing the table.
596 },
Craig Citro065b5302014-08-14 00:47:23 -0700597 "sourceTable": { # [Pick one] Source table to copy.
John Asmuth614db982014-04-24 15:46:26 -0400598 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
599 "tableId": "A String", # [Required] ID of the table.
600 "datasetId": "A String", # [Required] ID of the dataset containing the table.
601 },
602 },
603 "extract": { # [Pick one] Configures an extract job.
604 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700605 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400606 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700607 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
John Asmuth614db982014-04-24 15:46:26 -0400608 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
609 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
610 "A String",
611 ],
612 "sourceTable": { # [Required] A reference to the table being exported.
613 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
614 "tableId": "A String", # [Required] ID of the table.
615 "datasetId": "A String", # [Required] ID of the dataset containing the table.
616 },
617 },
618 },
619 "id": "A String", # [Output-only] Opaque ID field of the job
620 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
621 }</pre>
622</div>
623
624<div class="method">
625 <code class="details" id="list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</code>
626 <pre>Lists all the Jobs in the specified project that were started by the user.
627
628Args:
629 projectId: string, Project ID of the jobs to list (required)
630 projection: string, Restrict information returned to a set of selected fields
631 Allowed values
632 full - Includes all job data
633 minimal - Does not include the job configuration
634 stateFilter: string, Filter for job state (repeated)
635 Allowed values
636 done - Finished jobs
637 pending - Pending jobs
638 running - Running jobs
639 pageToken: string, Page token, returned by a previous call, to request the next page of results
640 allUsers: boolean, Whether to display jobs owned by all users in the project. Default false
641 maxResults: integer, Maximum number of results to return
642
643Returns:
644 An object of the form:
645
646 {
647 "nextPageToken": "A String", # A token to request the next page of results.
648 "totalItems": 42, # Total number of jobs in this collection.
649 "kind": "bigquery#jobList", # The resource type of the response.
650 "etag": "A String", # A hash of this page of results.
651 "jobs": [ # List of jobs that were requested.
652 {
653 "status": { # [Full-projection-only] Describes the state of the job.
654 "state": "A String", # [Output-only] Running state of the job.
655 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
656 {
657 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
658 "message": "A String", # A human-readable description of the error.
659 "reason": "A String", # A short error code that summarizes the error.
660 "location": "A String", # Specifies where the error occurred, if present.
661 },
662 ],
663 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
664 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
665 "message": "A String", # A human-readable description of the error.
666 "reason": "A String", # A short error code that summarizes the error.
667 "location": "A String", # Specifies where the error occurred, if present.
668 },
669 },
670 "kind": "bigquery#job", # The resource type.
671 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
672 "load": { # [Output-only] Statistics for a load job.
673 "outputRows": "A String", # [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
674 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
675 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
676 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while an import job is in the running state, this value may change.
677 },
678 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
679 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
680 "startTime": "A String", # [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
681 "query": { # [Output-only] Statistics for a query job.
682 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
683 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
684 },
685 "endTime": "A String", # [Output-only] End time of this job, in milliseconds since the epoch. This field will be present whenever a job is in the DONE state.
686 },
687 "jobReference": { # Job reference uniquely identifying the job.
688 "projectId": "A String", # [Required] Project ID being billed for the job.
689 "jobId": "A String", # [Required] ID of the job.
690 },
691 "state": "A String", # Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed.
692 "user_email": "A String", # [Full-projection-only] User who ran the job.
693 "configuration": { # [Full-projection-only] Specifies the job configuration.
694 "load": { # [Pick one] Configures a load job.
695 "encoding": "A String", # [Optional] The character encoding of the data. The supported values are UTF-8 or ISO-8859-1. The default value is UTF-8. BigQuery decodes the data after the raw, binary data has been split using the values of the quote and fieldDelimiter properties.
696 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. BigQuery also supports the escape sequence "\t" to specify a tab separator. The default value is a comma (',').
697 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
698 "destinationTable": { # [Required] The destination table to load the data into.
699 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
700 "tableId": "A String", # [Required] ID of the table.
701 "datasetId": "A String", # [Required] ID of the dataset containing the table.
702 },
703 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
704 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an 'invalid' error is returned in the job result and the job fails. The default value is 0, which requires that all records are valid.
705 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. Default is false which treats short rows as errors. Only applicable to CSV, ignored for other formats.
706 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
707 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data on Google Cloud Storage.
708 "A String",
709 ],
710 "quote": "A String", # [Optional] The value that is used to quote data sections in a CSV file. BigQuery converts the string to ISO-8859-1 encoding, and then uses the first byte of the encoded string to split the data in its raw, binary state. The default value is a double-quote ('"'). If your data does not contain quoted sections, set the property value to an empty string. If your data contains quoted newline characters, you must also set the allowQuotedNewlines property to true.
711 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
712 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
713 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
714 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
715 "ignoreUnknownValues": True or False, # [Optional] Accept rows that contain values that do not match the schema. The unknown values are ignored. Default is false which treats unknown values as errors. For CSV this ignores extra values at the end of a line. For JSON this ignores named values that do not match any column name.
716 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
717 "fields": [ # Describes the fields in a table.
718 {
719 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
720 # Object with schema name: TableFieldSchema
721 ],
722 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
723 "description": "A String", # [Optional] The field description.
724 "name": "A String", # [Required] The field name.
725 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
726 },
727 ],
728 },
729 },
730 "dryRun": True or False, # [Optional] If set, don't actually run this job. A valid query will return a mostly empty response with some processing statistics, while an invalid query will return the same error it would if it wasn't a dry run. Behavior of non-query jobs is undefined.
731 "link": { # [Pick one] Configures a link job.
732 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
733 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
734 "destinationTable": { # [Required] The destination table of the link job.
735 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
736 "tableId": "A String", # [Required] ID of the table.
737 "datasetId": "A String", # [Required] ID of the dataset containing the table.
738 },
739 "sourceUri": [ # [Required] URI of source table to link.
740 "A String",
741 ],
742 },
743 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700744 "flattenResults": True or False, # [Experimental] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
John Asmuth614db982014-04-24 15:46:26 -0400745 "useQueryCache": True or False, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified.
746 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
747 "projectId": "A String", # [Optional] The ID of the container project.
748 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
749 },
750 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
751 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
752 "tableId": "A String", # [Required] ID of the table.
753 "datasetId": "A String", # [Required] ID of the dataset containing the table.
754 },
755 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
756 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700757 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400758 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
759 "query": "A String", # [Required] BigQuery SQL query to execute.
760 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
761 },
762 "copy": { # [Pick one] Copies a table.
763 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700764 "sourceTables": [ # [Pick one] Source tables to copy.
765 {
766 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
767 "tableId": "A String", # [Required] ID of the table.
768 "datasetId": "A String", # [Required] ID of the dataset containing the table.
769 },
770 ],
John Asmuth614db982014-04-24 15:46:26 -0400771 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
772 "destinationTable": { # [Required] The destination table
773 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
774 "tableId": "A String", # [Required] ID of the table.
775 "datasetId": "A String", # [Required] ID of the dataset containing the table.
776 },
Craig Citro065b5302014-08-14 00:47:23 -0700777 "sourceTable": { # [Pick one] Source table to copy.
John Asmuth614db982014-04-24 15:46:26 -0400778 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
779 "tableId": "A String", # [Required] ID of the table.
780 "datasetId": "A String", # [Required] ID of the dataset containing the table.
781 },
782 },
783 "extract": { # [Pick one] Configures an extract job.
784 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700785 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400786 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700787 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
John Asmuth614db982014-04-24 15:46:26 -0400788 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
789 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
790 "A String",
791 ],
792 "sourceTable": { # [Required] A reference to the table being exported.
793 "projectId": "A String", # [Required] ID of the project billed for storage of the table.
794 "tableId": "A String", # [Required] ID of the table.
795 "datasetId": "A String", # [Required] ID of the dataset containing the table.
796 },
797 },
798 },
799 "id": "A String", # Unique opaque ID of the job.
800 "errorResult": { # A result object that will be present only if the job has failed.
801 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
802 "message": "A String", # A human-readable description of the error.
803 "reason": "A String", # A short error code that summarizes the error.
804 "location": "A String", # Specifies where the error occurred, if present.
805 },
806 },
807 ],
808 }</pre>
809</div>
810
811<div class="method">
812 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
813 <pre>Retrieves the next page of results.
814
815Args:
816 previous_request: The request for the previous page. (required)
817 previous_response: The response from the request for the previous page. (required)
818
819Returns:
820 A request object that you can call 'execute()' on to request the next
821 page. Returns None if there are no more items in the collection.
822 </pre>
823</div>
824
825<div class="method">
826 <code class="details" id="query">query(projectId, body)</code>
827 <pre>Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
828
829Args:
830 projectId: string, Project ID of the project billed for the query (required)
831 body: object, The request body. (required)
832 The object takes the form of:
833
834{
835 "timeoutMs": 42, # [Optional] How long to wait for the query to complete, in milliseconds, before the request times out and returns. Note that this is only a timeout for the request, not the query. If the query takes longer to run than the timeout value, the call returns without any results and with the 'jobComplete' flag set to false. You can call GetQueryResults() to wait for the query to complete and read the results. The default value is 10000 milliseconds (10 seconds).
836 "kind": "bigquery#queryRequest", # The resource type of the request.
837 "dryRun": True or False, # [Optional] If set, don't actually run the query. A valid query will return an empty response, while an invalid query will return the same error it would if it wasn't a dry run. The default value is false.
838 "useQueryCache": True or False, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true.
839 "defaultDataset": { # [Optional] Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'.
840 "projectId": "A String", # [Optional] The ID of the container project.
841 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name.
842 },
843 "maxResults": 42, # [Optional] The maximum number of rows of data to return per page of results. Setting this flag to a small value such as 1000 and then paging through results might improve reliability when the query result set is large. In addition to this limit, responses are also limited to 10 MB. By default, there is no maximum row count, and only the byte limit applies.
844 "query": "A String", # [Required] A query string, following the BigQuery query syntax, of the query to execute. Example: "SELECT count(f1) FROM [myProjectId:myDatasetId.myTableId]".
845 "preserveNulls": True or False, # [Deprecated] If set to false, maps null values in the query response to the column's default value. Only specify if you have older code that can not handle null values in the query response. The default value is true. This flag is deprecated and will be ignored in a future version of BigQuery.
846 }
847
848
849Returns:
850 An object of the form:
851
852 {
853 "kind": "bigquery#queryResponse", # The resource type.
854 "rows": [ # An object with as many results as can be contained within the maximum permitted reply size. To get any additional rows, you can call GetQueryResults and specify the jobReference returned above.
855 { # Represents a single row in the result set, consisting of one or more fields.
856 "f": [
857 { # Represents a single cell in the result set. Users of the java client can detect whether their value result is null by calling 'com.google.api.client.util.Data.isNull(cell.getV())'.
858 "v": "",
859 },
860 ],
861 },
862 ],
863 "jobReference": { # Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults).
864 "projectId": "A String", # [Required] Project ID being billed for the job.
865 "jobId": "A String", # [Required] ID of the job.
866 },
867 "pageToken": "A String", # A token used for paging results.
868 "jobComplete": True or False, # Whether the query has completed or not. If rows or totalRows are present, this will always be true. If this is false, totalRows will not be available.
869 "totalRows": "A String", # The total number of rows in the complete query result set, which can be more than the number of rows in this single page of results.
870 "totalBytesProcessed": "A String", # The total number of bytes processed for this query. If this query was a dry run, this is the number of bytes that would be processed if the query were run.
871 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
872 "schema": { # The schema of the results. Present only when the query completes successfully.
873 "fields": [ # Describes the fields in a table.
874 {
875 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
876 # Object with schema name: TableFieldSchema
877 ],
878 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
879 "description": "A String", # [Optional] The field description.
880 "name": "A String", # [Required] The field name.
881 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
882 },
883 ],
884 },
885 }</pre>
886</div>
887
888</body></html>