blob: f0f2fdb4159a4906f080dc990420cbe43fd5b994 [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>
Craig Citro0e5b9bf2014-10-15 10:26:14 -070088<p class="firstline">Lists all the Jobs in the specified project that were started by the user. The job list returns in reverse chronological order of when the jobs were created, starting with the most recent job created.</p>
John Asmuth614db982014-04-24 15:46:26 -040089<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.
Craig Citroe633be12015-03-02 13:40:36 -0800141 "extract": { # [Output-only] Statistics for an extract job.
142 "destinationUriFileCounts": [ # [Experimental] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
143 "A String",
144 ],
145 },
John Asmuth614db982014-04-24 15:46:26 -0400146 },
147 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800148 "projectId": "A String", # [Required] The ID of the project containing this job.
149 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400150 },
151 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800152 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400153 "configuration": { # [Required] Describes the job configuration.
154 "load": { # [Pick one] Configures a load job.
155 "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.
156 "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 (',').
157 "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.
158 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800159 "projectId": "A String", # [Required] The ID of the project containing this table.
160 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
161 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400162 },
163 "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.
164 "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.
165 "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.
166 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800167 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Wildcard names are only supported when they appear at the end of the URI.
John Asmuth614db982014-04-24 15:46:26 -0400168 "A String",
169 ],
170 "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.
171 "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.
172 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
173 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
174 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800175 "projectionFields": [ # [Experimental] Names(case-sensitive) of properties to keep when importing data. If this is populated, only the specified properties will be imported for each entity. Currently, this is only supported for DATASTORE_BACKUP imports and only top level properties are supported. If any specified property is not found in the Datastore 'Kind' being imported, that is an error. Note: This feature is experimental and can change in the future.
176 "A String",
177 ],
John Asmuth614db982014-04-24 15:46:26 -0400178 "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.
179 "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.
180 "fields": [ # Describes the fields in a table.
181 {
182 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
183 # Object with schema name: TableFieldSchema
184 ],
185 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800186 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
187 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400188 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
189 },
190 ],
191 },
192 },
193 "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.
194 "link": { # [Pick one] Configures a link job.
195 "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.
196 "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.
197 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800198 "projectId": "A String", # [Required] The ID of the project containing this table.
199 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
200 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400201 },
202 "sourceUri": [ # [Required] URI of source table to link.
203 "A String",
204 ],
205 },
206 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700207 "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 -0400208 "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.
209 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800210 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
211 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400212 },
213 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800214 "projectId": "A String", # [Required] The ID of the project containing this table.
215 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
216 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400217 },
218 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
219 "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 -0700220 "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 -0400221 "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.
222 "query": "A String", # [Required] BigQuery SQL query to execute.
223 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
224 },
225 "copy": { # [Pick one] Copies a table.
226 "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 -0700227 "sourceTables": [ # [Pick one] Source tables to copy.
228 {
Craig Citroe633be12015-03-02 13:40:36 -0800229 "projectId": "A String", # [Required] The ID of the project containing this table.
230 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
231 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700232 },
233 ],
John Asmuth614db982014-04-24 15:46:26 -0400234 "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.
235 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800236 "projectId": "A String", # [Required] The ID of the project containing this table.
237 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
238 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400239 },
Craig Citro065b5302014-08-14 00:47:23 -0700240 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800241 "projectId": "A String", # [Required] The ID of the project containing this table.
242 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
243 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400244 },
245 },
246 "extract": { # [Pick one] Configures an extract job.
247 "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 -0700248 "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 -0400249 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700250 "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 -0400251 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
252 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
253 "A String",
254 ],
255 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800256 "projectId": "A String", # [Required] The ID of the project containing this table.
257 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
258 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400259 },
260 },
261 },
262 "id": "A String", # [Output-only] Opaque ID field of the job
263 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
264 }</pre>
265</div>
266
267<div class="method">
268 <code class="details" id="getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</code>
269 <pre>Retrieves the results of a query job.
270
271Args:
272 projectId: string, Project ID of the query job (required)
273 jobId: string, Job ID of the query job (required)
274 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
275 pageToken: string, Page token, returned by a previous call, to request the next page of results
276 maxResults: integer, Maximum number of results to read
277 startIndex: string, Zero-based index of the starting row
278
279Returns:
280 An object of the form:
281
282 {
283 "kind": "bigquery#getQueryResultsResponse", # The resource type of the response.
284 "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.
285 { # Represents a single row in the result set, consisting of one or more fields.
286 "f": [
287 { # 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())'.
288 "v": "",
289 },
290 ],
291 },
292 ],
293 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800294 "projectId": "A String", # [Required] The ID of the project containing this job.
295 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400296 },
297 "pageToken": "A String", # A token used for paging results.
298 "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.
299 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800300 "totalBytesProcessed": "A String", # The total number of bytes processed for this query.
John Asmuth614db982014-04-24 15:46:26 -0400301 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
302 "etag": "A String", # A hash of this response.
303 "schema": { # The schema of the results. Present only when the query completes successfully.
304 "fields": [ # Describes the fields in a table.
305 {
306 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
307 # Object with schema name: TableFieldSchema
308 ],
309 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800310 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
311 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400312 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
313 },
314 ],
315 },
316 }</pre>
317</div>
318
319<div class="method">
320 <code class="details" id="insert">insert(projectId, body=None, media_body=None)</code>
321 <pre>Starts a new asynchronous job.
322
323Args:
324 projectId: string, Project ID of the project that will be billed for the job (required)
325 body: object, The request body.
326 The object takes the form of:
327
328{
329 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
330 "state": "A String", # [Output-only] Running state of the job.
331 "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.
332 {
333 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
334 "message": "A String", # A human-readable description of the error.
335 "reason": "A String", # A short error code that summarizes the error.
336 "location": "A String", # Specifies where the error occurred, if present.
337 },
338 ],
339 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
340 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
341 "message": "A String", # A human-readable description of the error.
342 "reason": "A String", # A short error code that summarizes the error.
343 "location": "A String", # Specifies where the error occurred, if present.
344 },
345 },
346 "kind": "bigquery#job", # [Output-only] The type of the resource.
347 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
348 "load": { # [Output-only] Statistics for a load job.
349 "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.
350 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
351 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
352 "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.
353 },
354 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
355 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
356 "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.
357 "query": { # [Output-only] Statistics for a query job.
358 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
359 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
360 },
361 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800362 "extract": { # [Output-only] Statistics for an extract job.
363 "destinationUriFileCounts": [ # [Experimental] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
364 "A String",
365 ],
366 },
John Asmuth614db982014-04-24 15:46:26 -0400367 },
368 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800369 "projectId": "A String", # [Required] The ID of the project containing this job.
370 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400371 },
372 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800373 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400374 "configuration": { # [Required] Describes the job configuration.
375 "load": { # [Pick one] Configures a load job.
376 "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.
377 "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 (',').
378 "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.
379 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800380 "projectId": "A String", # [Required] The ID of the project containing this table.
381 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
382 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400383 },
384 "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.
385 "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.
386 "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.
387 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800388 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Wildcard names are only supported when they appear at the end of the URI.
John Asmuth614db982014-04-24 15:46:26 -0400389 "A String",
390 ],
391 "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.
392 "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.
393 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
394 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
395 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800396 "projectionFields": [ # [Experimental] Names(case-sensitive) of properties to keep when importing data. If this is populated, only the specified properties will be imported for each entity. Currently, this is only supported for DATASTORE_BACKUP imports and only top level properties are supported. If any specified property is not found in the Datastore 'Kind' being imported, that is an error. Note: This feature is experimental and can change in the future.
397 "A String",
398 ],
John Asmuth614db982014-04-24 15:46:26 -0400399 "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.
400 "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.
401 "fields": [ # Describes the fields in a table.
402 {
403 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
404 # Object with schema name: TableFieldSchema
405 ],
406 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800407 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
408 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400409 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
410 },
411 ],
412 },
413 },
414 "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.
415 "link": { # [Pick one] Configures a link job.
416 "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.
417 "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.
418 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800419 "projectId": "A String", # [Required] The ID of the project containing this table.
420 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
421 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400422 },
423 "sourceUri": [ # [Required] URI of source table to link.
424 "A String",
425 ],
426 },
427 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700428 "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 -0400429 "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.
430 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800431 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
432 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400433 },
434 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800435 "projectId": "A String", # [Required] The ID of the project containing this table.
436 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
437 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400438 },
439 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
440 "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 -0700441 "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 -0400442 "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.
443 "query": "A String", # [Required] BigQuery SQL query to execute.
444 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
445 },
446 "copy": { # [Pick one] Copies a table.
447 "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 -0700448 "sourceTables": [ # [Pick one] Source tables to copy.
449 {
Craig Citroe633be12015-03-02 13:40:36 -0800450 "projectId": "A String", # [Required] The ID of the project containing this table.
451 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
452 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700453 },
454 ],
John Asmuth614db982014-04-24 15:46:26 -0400455 "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.
456 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800457 "projectId": "A String", # [Required] The ID of the project containing this table.
458 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
459 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400460 },
Craig Citro065b5302014-08-14 00:47:23 -0700461 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800462 "projectId": "A String", # [Required] The ID of the project containing this table.
463 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
464 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400465 },
466 },
467 "extract": { # [Pick one] Configures an extract job.
468 "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 -0700469 "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 -0400470 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700471 "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 -0400472 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
473 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
474 "A String",
475 ],
476 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800477 "projectId": "A String", # [Required] The ID of the project containing this table.
478 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
479 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400480 },
481 },
482 },
483 "id": "A String", # [Output-only] Opaque ID field of the job
484 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
485 }
486
487 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
488
489Returns:
490 An object of the form:
491
492 {
493 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
494 "state": "A String", # [Output-only] Running state of the job.
495 "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.
496 {
497 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
498 "message": "A String", # A human-readable description of the error.
499 "reason": "A String", # A short error code that summarizes the error.
500 "location": "A String", # Specifies where the error occurred, if present.
501 },
502 ],
503 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
504 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
505 "message": "A String", # A human-readable description of the error.
506 "reason": "A String", # A short error code that summarizes the error.
507 "location": "A String", # Specifies where the error occurred, if present.
508 },
509 },
510 "kind": "bigquery#job", # [Output-only] The type of the resource.
511 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
512 "load": { # [Output-only] Statistics for a load job.
513 "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.
514 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
515 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
516 "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.
517 },
518 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
519 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
520 "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.
521 "query": { # [Output-only] Statistics for a query job.
522 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
523 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
524 },
525 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800526 "extract": { # [Output-only] Statistics for an extract job.
527 "destinationUriFileCounts": [ # [Experimental] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
528 "A String",
529 ],
530 },
John Asmuth614db982014-04-24 15:46:26 -0400531 },
532 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800533 "projectId": "A String", # [Required] The ID of the project containing this job.
534 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400535 },
536 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800537 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400538 "configuration": { # [Required] Describes the job configuration.
539 "load": { # [Pick one] Configures a load job.
540 "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.
541 "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 (',').
542 "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.
543 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800544 "projectId": "A String", # [Required] The ID of the project containing this table.
545 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
546 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400547 },
548 "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.
549 "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.
550 "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.
551 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800552 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Wildcard names are only supported when they appear at the end of the URI.
John Asmuth614db982014-04-24 15:46:26 -0400553 "A String",
554 ],
555 "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.
556 "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.
557 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
558 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
559 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800560 "projectionFields": [ # [Experimental] Names(case-sensitive) of properties to keep when importing data. If this is populated, only the specified properties will be imported for each entity. Currently, this is only supported for DATASTORE_BACKUP imports and only top level properties are supported. If any specified property is not found in the Datastore 'Kind' being imported, that is an error. Note: This feature is experimental and can change in the future.
561 "A String",
562 ],
John Asmuth614db982014-04-24 15:46:26 -0400563 "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.
564 "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.
565 "fields": [ # Describes the fields in a table.
566 {
567 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
568 # Object with schema name: TableFieldSchema
569 ],
570 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800571 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
572 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400573 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
574 },
575 ],
576 },
577 },
578 "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.
579 "link": { # [Pick one] Configures a link job.
580 "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.
581 "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.
582 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800583 "projectId": "A String", # [Required] The ID of the project containing this table.
584 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
585 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400586 },
587 "sourceUri": [ # [Required] URI of source table to link.
588 "A String",
589 ],
590 },
591 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700592 "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 -0400593 "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.
594 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800595 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
596 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400597 },
598 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800599 "projectId": "A String", # [Required] The ID of the project containing this table.
600 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
601 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400602 },
603 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
604 "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 -0700605 "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 -0400606 "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.
607 "query": "A String", # [Required] BigQuery SQL query to execute.
608 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
609 },
610 "copy": { # [Pick one] Copies a table.
611 "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 -0700612 "sourceTables": [ # [Pick one] Source tables to copy.
613 {
Craig Citroe633be12015-03-02 13:40:36 -0800614 "projectId": "A String", # [Required] The ID of the project containing this table.
615 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
616 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700617 },
618 ],
John Asmuth614db982014-04-24 15:46:26 -0400619 "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.
620 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800621 "projectId": "A String", # [Required] The ID of the project containing this table.
622 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
623 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400624 },
Craig Citro065b5302014-08-14 00:47:23 -0700625 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800626 "projectId": "A String", # [Required] The ID of the project containing this table.
627 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
628 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400629 },
630 },
631 "extract": { # [Pick one] Configures an extract job.
632 "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 -0700633 "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 -0400634 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700635 "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 -0400636 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
637 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
638 "A String",
639 ],
640 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800641 "projectId": "A String", # [Required] The ID of the project containing this table.
642 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
643 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400644 },
645 },
646 },
647 "id": "A String", # [Output-only] Opaque ID field of the job
648 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
649 }</pre>
650</div>
651
652<div class="method">
653 <code class="details" id="list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</code>
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700654 <pre>Lists all the Jobs in the specified project that were started by the user. The job list returns in reverse chronological order of when the jobs were created, starting with the most recent job created.
John Asmuth614db982014-04-24 15:46:26 -0400655
656Args:
657 projectId: string, Project ID of the jobs to list (required)
658 projection: string, Restrict information returned to a set of selected fields
659 Allowed values
660 full - Includes all job data
661 minimal - Does not include the job configuration
662 stateFilter: string, Filter for job state (repeated)
663 Allowed values
664 done - Finished jobs
665 pending - Pending jobs
666 running - Running jobs
667 pageToken: string, Page token, returned by a previous call, to request the next page of results
668 allUsers: boolean, Whether to display jobs owned by all users in the project. Default false
669 maxResults: integer, Maximum number of results to return
670
671Returns:
672 An object of the form:
673
674 {
675 "nextPageToken": "A String", # A token to request the next page of results.
676 "totalItems": 42, # Total number of jobs in this collection.
677 "kind": "bigquery#jobList", # The resource type of the response.
678 "etag": "A String", # A hash of this page of results.
679 "jobs": [ # List of jobs that were requested.
680 {
681 "status": { # [Full-projection-only] Describes the state of the job.
682 "state": "A String", # [Output-only] Running state of the job.
683 "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.
684 {
685 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
686 "message": "A String", # A human-readable description of the error.
687 "reason": "A String", # A short error code that summarizes the error.
688 "location": "A String", # Specifies where the error occurred, if present.
689 },
690 ],
691 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
692 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
693 "message": "A String", # A human-readable description of the error.
694 "reason": "A String", # A short error code that summarizes the error.
695 "location": "A String", # Specifies where the error occurred, if present.
696 },
697 },
698 "kind": "bigquery#job", # The resource type.
699 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
700 "load": { # [Output-only] Statistics for a load job.
701 "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.
702 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
703 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
704 "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.
705 },
706 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
707 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
708 "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.
709 "query": { # [Output-only] Statistics for a query job.
710 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
711 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
712 },
713 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800714 "extract": { # [Output-only] Statistics for an extract job.
715 "destinationUriFileCounts": [ # [Experimental] Number of files per destination URI or URI pattern specified in the extract configuration. These values will be in the same order as the URIs specified in the 'destinationUris' field.
716 "A String",
717 ],
718 },
John Asmuth614db982014-04-24 15:46:26 -0400719 },
720 "jobReference": { # Job reference uniquely identifying the job.
Craig Citroe633be12015-03-02 13:40:36 -0800721 "projectId": "A String", # [Required] The ID of the project containing this job.
722 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400723 },
724 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800725 "user_email": "A String", # [Full-projection-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400726 "configuration": { # [Full-projection-only] Specifies the job configuration.
727 "load": { # [Pick one] Configures a load job.
728 "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.
729 "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 (',').
730 "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.
731 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800732 "projectId": "A String", # [Required] The ID of the project containing this table.
733 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
734 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400735 },
736 "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.
737 "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.
738 "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.
739 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800740 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Wildcard names are only supported when they appear at the end of the URI.
John Asmuth614db982014-04-24 15:46:26 -0400741 "A String",
742 ],
743 "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.
744 "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.
745 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
746 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
747 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800748 "projectionFields": [ # [Experimental] Names(case-sensitive) of properties to keep when importing data. If this is populated, only the specified properties will be imported for each entity. Currently, this is only supported for DATASTORE_BACKUP imports and only top level properties are supported. If any specified property is not found in the Datastore 'Kind' being imported, that is an error. Note: This feature is experimental and can change in the future.
749 "A String",
750 ],
John Asmuth614db982014-04-24 15:46:26 -0400751 "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.
752 "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.
753 "fields": [ # Describes the fields in a table.
754 {
755 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
756 # Object with schema name: TableFieldSchema
757 ],
758 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800759 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
760 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400761 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
762 },
763 ],
764 },
765 },
766 "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.
767 "link": { # [Pick one] Configures a link job.
768 "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.
769 "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.
770 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800771 "projectId": "A String", # [Required] The ID of the project containing this table.
772 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
773 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400774 },
775 "sourceUri": [ # [Required] URI of source table to link.
776 "A String",
777 ],
778 },
779 "query": { # [Pick one] Configures a query job.
Craig Citro065b5302014-08-14 00:47:23 -0700780 "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 -0400781 "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.
782 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800783 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
784 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400785 },
786 "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.
Craig Citroe633be12015-03-02 13:40:36 -0800787 "projectId": "A String", # [Required] The ID of the project containing this table.
788 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
789 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400790 },
791 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
792 "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 -0700793 "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 -0400794 "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.
795 "query": "A String", # [Required] BigQuery SQL query to execute.
796 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
797 },
798 "copy": { # [Pick one] Copies a table.
799 "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 -0700800 "sourceTables": [ # [Pick one] Source tables to copy.
801 {
Craig Citroe633be12015-03-02 13:40:36 -0800802 "projectId": "A String", # [Required] The ID of the project containing this table.
803 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
804 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700805 },
806 ],
John Asmuth614db982014-04-24 15:46:26 -0400807 "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.
808 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800809 "projectId": "A String", # [Required] The ID of the project containing this table.
810 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
811 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400812 },
Craig Citro065b5302014-08-14 00:47:23 -0700813 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800814 "projectId": "A String", # [Required] The ID of the project containing this table.
815 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
816 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400817 },
818 },
819 "extract": { # [Pick one] Configures an extract job.
820 "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 -0700821 "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 -0400822 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700823 "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 -0400824 "printHeader": True or False, # [Optional] Whether to print out a header row in the results. Default is true.
825 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
826 "A String",
827 ],
828 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800829 "projectId": "A String", # [Required] The ID of the project containing this table.
830 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
831 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400832 },
833 },
834 },
835 "id": "A String", # Unique opaque ID of the job.
836 "errorResult": { # A result object that will be present only if the job has failed.
837 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
838 "message": "A String", # A human-readable description of the error.
839 "reason": "A String", # A short error code that summarizes the error.
840 "location": "A String", # Specifies where the error occurred, if present.
841 },
842 },
843 ],
844 }</pre>
845</div>
846
847<div class="method">
848 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
849 <pre>Retrieves the next page of results.
850
851Args:
852 previous_request: The request for the previous page. (required)
853 previous_response: The response from the request for the previous page. (required)
854
855Returns:
856 A request object that you can call 'execute()' on to request the next
857 page. Returns None if there are no more items in the collection.
858 </pre>
859</div>
860
861<div class="method">
862 <code class="details" id="query">query(projectId, body)</code>
863 <pre>Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
864
865Args:
866 projectId: string, Project ID of the project billed for the query (required)
867 body: object, The request body. (required)
868 The object takes the form of:
869
870{
871 "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).
872 "kind": "bigquery#queryRequest", # The resource type of the request.
Craig Citroe633be12015-03-02 13:40:36 -0800873 "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.
John Asmuth614db982014-04-24 15:46:26 -0400874 "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.
875 "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'.
Craig Citroe633be12015-03-02 13:40:36 -0800876 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
877 "datasetId": "A String", # [Required] A unique ID for this dataset, without the project name. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400878 },
879 "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.
880 "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]".
Craig Citro0e5b9bf2014-10-15 10:26:14 -0700881 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
John Asmuth614db982014-04-24 15:46:26 -0400882 }
883
884
885Returns:
886 An object of the form:
887
888 {
889 "kind": "bigquery#queryResponse", # The resource type.
890 "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.
891 { # Represents a single row in the result set, consisting of one or more fields.
892 "f": [
893 { # 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())'.
894 "v": "",
895 },
896 ],
897 },
898 ],
899 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800900 "projectId": "A String", # [Required] The ID of the project containing this job.
901 "jobId": "A String", # [Required] The ID of the job. The ID must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -0400902 },
903 "pageToken": "A String", # A token used for paging results.
904 "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.
905 "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.
906 "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.
907 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
908 "schema": { # The schema of the results. Present only when the query completes successfully.
909 "fields": [ # Describes the fields in a table.
910 {
911 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
912 # Object with schema name: TableFieldSchema
913 ],
914 "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).
Craig Citroe633be12015-03-02 13:40:36 -0800915 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
916 "name": "A String", # [Required] The field name. The name must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_), and must start with a letter or underscore. The maximum length is 128 characters.
John Asmuth614db982014-04-24 15:46:26 -0400917 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
918 },
919 ],
920 },
921 }</pre>
922</div>
923
924</body></html>