blob: fb4ba1a44fc4c31556c2cbd83a0de68d8878677d [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">
Nathaniel Manista4f877e52015-06-15 16:44:50 +000078 <code><a href="#cancel">cancel(projectId, jobId)</a></code></p>
79<p class="firstline">Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully.</p>
80<p class="toc_element">
John Asmuth614db982014-04-24 15:46:26 -040081 <code><a href="#get">get(projectId, jobId)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000082<p class="firstline">Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.</p>
John Asmuth614db982014-04-24 15:46:26 -040083<p class="toc_element">
84 <code><a href="#getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</a></code></p>
85<p class="firstline">Retrieves the results of a query job.</p>
86<p class="toc_element">
87 <code><a href="#insert">insert(projectId, body=None, media_body=None)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000088<p class="firstline">Starts a new asynchronous job. Requires the Can View project role.</p>
John Asmuth614db982014-04-24 15:46:26 -040089<p class="toc_element">
90 <code><a href="#list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000091<p class="firstline">Lists all jobs that you started in the specified project. The job list returns in reverse chronological order of when the jobs were created, starting with the most recent job created. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.</p>
John Asmuth614db982014-04-24 15:46:26 -040092<p class="toc_element">
93 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
94<p class="firstline">Retrieves the next page of results.</p>
95<p class="toc_element">
96 <code><a href="#query">query(projectId, body)</a></code></p>
97<p class="firstline">Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.</p>
98<h3>Method Details</h3>
99<div class="method">
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000100 <code class="details" id="cancel">cancel(projectId, jobId)</code>
101 <pre>Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully.
102
103Args:
104 projectId: string, Project ID of the job to cancel (required)
105 jobId: string, Job ID of the job to cancel (required)
106
107Returns:
108 An object of the form:
109
110 {
111 "job": { # The final state of the job.
112 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
113 "state": "A String", # [Output-only] Running state of the job.
114 "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.
115 {
116 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
117 "message": "A String", # A human-readable description of the error.
118 "reason": "A String", # A short error code that summarizes the error.
119 "location": "A String", # Specifies where the error occurred, if present.
120 },
121 ],
122 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
123 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
124 "message": "A String", # A human-readable description of the error.
125 "reason": "A String", # A short error code that summarizes the error.
126 "location": "A String", # Specifies where the error occurred, if present.
127 },
128 },
129 "kind": "bigquery#job", # [Output-only] The type of the resource.
130 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
131 "load": { # [Output-only] Statistics for a load job.
132 "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.
133 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
134 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
135 "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.
136 },
137 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
138 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
139 "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.
140 "query": { # [Output-only] Statistics for a query job.
141 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
142 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
143 },
144 "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.
145 "extract": { # [Output-only] Statistics for an extract job.
146 "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.
147 "A String",
148 ],
149 },
150 },
151 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
152 "projectId": "A String", # [Required] The ID of the project containing this job.
153 "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.
154 },
155 "etag": "A String", # [Output-only] A hash of this resource.
156 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
157 "configuration": { # [Required] Describes the job configuration.
158 "load": { # [Pick one] Configures a load job.
159 "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.
160 "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 (',').
161 "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.
162 "destinationTable": { # [Required] The destination table to load the data into.
163 "projectId": "A String", # [Required] The ID of the project containing this table.
164 "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.
165 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
166 },
167 "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_APPEND. 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.
168 "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. The default value is 0, which requires that all records are valid.
169 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
170 "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.
171 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
172 "A String",
173 ],
174 "quote": """, # [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.
175 "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.
176 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
177 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
178 "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.
179 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
180 "A String",
181 ],
182 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
183 "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.
184 "fields": [ # Describes the fields in a table.
185 {
186 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
187 # Object with schema name: TableFieldSchema
188 ],
189 "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).
190 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
191 "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.
192 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
193 },
194 ],
195 },
196 },
197 "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.
198 "link": { # [Pick one] Configures a link job.
199 "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.
200 "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.
201 "destinationTable": { # [Required] The destination table of the link job.
202 "projectId": "A String", # [Required] The ID of the project containing this table.
203 "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.
204 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
205 },
206 "sourceUri": [ # [Required] URI of source table to link.
207 "A String",
208 ],
209 },
210 "query": { # [Pick one] Configures a query job.
211 "flattenResults": true, # [Optional] 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.
212 "useQueryCache": true, # [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. The default value is true.
213 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
214 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
215 "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.
216 },
217 "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.
218 "projectId": "A String", # [Required] The ID of the project containing this table.
219 "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.
220 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
221 },
222 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
223 "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.
224 "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.
225 "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.
226 "query": "A String", # [Required] BigQuery SQL query to execute.
227 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
228 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
229 "a_key": {
230 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
231 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
232 "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 (',').
233 "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.
234 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
235 "allowJaggedRows": True or False, # [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
236 "quote": """, # [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.
237 "allowQuotedNewlines": True or False, # [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
238 },
239 "sourceFormat": "A String", # [Optional] The data format. External data sources must be in CSV format. The default value is CSV.
240 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
241 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns
242 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. CSV limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
243 "A String",
244 ],
245 "schema": { # [Required] The schema for the data.
246 "fields": [ # Describes the fields in a table.
247 {
248 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
249 # Object with schema name: TableFieldSchema
250 ],
251 "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).
252 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
253 "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.
254 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
255 },
256 ],
257 },
258 },
259 },
260 },
261 "copy": { # [Pick one] Copies a table.
262 "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.
263 "sourceTables": [ # [Pick one] Source tables to copy.
264 {
265 "projectId": "A String", # [Required] The ID of the project containing this table.
266 "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.
267 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
268 },
269 ],
270 "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.
271 "destinationTable": { # [Required] The destination table
272 "projectId": "A String", # [Required] The ID of the project containing this table.
273 "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.
274 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
275 },
276 "sourceTable": { # [Pick one] Source table to copy.
277 "projectId": "A String", # [Required] The ID of the project containing this table.
278 "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.
279 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
280 },
281 },
282 "extract": { # [Pick one] Configures an extract job.
283 "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.
284 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
285 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
286 "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.
287 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
288 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
289 "A String",
290 ],
291 "sourceTable": { # [Required] A reference to the table being exported.
292 "projectId": "A String", # [Required] The ID of the project containing this table.
293 "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.
294 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
295 },
296 },
297 },
298 "id": "A String", # [Output-only] Opaque ID field of the job
299 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
300 },
301 "kind": "bigquery#jobCancelResponse", # The resource type of the response.
302 }</pre>
303</div>
304
305<div class="method">
John Asmuth614db982014-04-24 15:46:26 -0400306 <code class="details" id="get">get(projectId, jobId)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000307 <pre>Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.
John Asmuth614db982014-04-24 15:46:26 -0400308
309Args:
310 projectId: string, Project ID of the requested job (required)
311 jobId: string, Job ID of the requested job (required)
312
313Returns:
314 An object of the form:
315
316 {
317 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
318 "state": "A String", # [Output-only] Running state of the job.
319 "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.
320 {
321 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
322 "message": "A String", # A human-readable description of the error.
323 "reason": "A String", # A short error code that summarizes the error.
324 "location": "A String", # Specifies where the error occurred, if present.
325 },
326 ],
327 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
328 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
329 "message": "A String", # A human-readable description of the error.
330 "reason": "A String", # A short error code that summarizes the error.
331 "location": "A String", # Specifies where the error occurred, if present.
332 },
333 },
334 "kind": "bigquery#job", # [Output-only] The type of the resource.
335 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
336 "load": { # [Output-only] Statistics for a load job.
337 "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.
338 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
339 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
340 "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.
341 },
342 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
343 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
344 "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.
345 "query": { # [Output-only] Statistics for a query job.
346 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
347 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
348 },
349 "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 -0800350 "extract": { # [Output-only] Statistics for an extract job.
351 "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.
352 "A String",
353 ],
354 },
John Asmuth614db982014-04-24 15:46:26 -0400355 },
356 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800357 "projectId": "A String", # [Required] The ID of the project containing this job.
358 "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 -0400359 },
360 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800361 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400362 "configuration": { # [Required] Describes the job configuration.
363 "load": { # [Pick one] Configures a load job.
364 "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.
365 "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 (',').
366 "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.
367 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800368 "projectId": "A String", # [Required] The ID of the project containing this table.
369 "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.
370 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400371 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000372 "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_APPEND. 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.
373 "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. The default value is 0, which requires that all records are valid.
374 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400375 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000376 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400377 "A String",
378 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000379 "quote": """, # [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.
John Asmuth614db982014-04-24 15:46:26 -0400380 "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.
381 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
382 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
383 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000384 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800385 "A String",
386 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000387 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400388 "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.
389 "fields": [ # Describes the fields in a table.
390 {
391 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
392 # Object with schema name: TableFieldSchema
393 ],
394 "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 -0800395 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
396 "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 -0400397 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
398 },
399 ],
400 },
401 },
402 "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.
403 "link": { # [Pick one] Configures a link job.
404 "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.
405 "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.
406 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800407 "projectId": "A String", # [Required] The ID of the project containing this table.
408 "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.
409 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400410 },
411 "sourceUri": [ # [Required] URI of source table to link.
412 "A String",
413 ],
414 },
415 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000416 "flattenResults": true, # [Optional] 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.
417 "useQueryCache": true, # [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. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400418 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800419 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
420 "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 -0400421 },
422 "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 -0800423 "projectId": "A String", # [Required] The ID of the project containing this table.
424 "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.
425 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400426 },
427 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
428 "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 -0700429 "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 -0400430 "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.
431 "query": "A String", # [Required] BigQuery SQL query to execute.
432 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000433 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
434 "a_key": {
435 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
436 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
437 "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 (',').
438 "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.
439 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
440 "allowJaggedRows": True or False, # [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
441 "quote": """, # [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.
442 "allowQuotedNewlines": True or False, # [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
443 },
444 "sourceFormat": "A String", # [Optional] The data format. External data sources must be in CSV format. The default value is CSV.
445 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
446 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns
447 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. CSV limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
448 "A String",
449 ],
450 "schema": { # [Required] The schema for the data.
451 "fields": [ # Describes the fields in a table.
452 {
453 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
454 # Object with schema name: TableFieldSchema
455 ],
456 "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).
457 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
458 "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.
459 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
460 },
461 ],
462 },
463 },
464 },
John Asmuth614db982014-04-24 15:46:26 -0400465 },
466 "copy": { # [Pick one] Copies a table.
467 "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 -0700468 "sourceTables": [ # [Pick one] Source tables to copy.
469 {
Craig Citroe633be12015-03-02 13:40:36 -0800470 "projectId": "A String", # [Required] The ID of the project containing this table.
471 "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.
472 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700473 },
474 ],
John Asmuth614db982014-04-24 15:46:26 -0400475 "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.
476 "destinationTable": { # [Required] The destination table
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 },
Craig Citro065b5302014-08-14 00:47:23 -0700481 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800482 "projectId": "A String", # [Required] The ID of the project containing this table.
483 "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.
484 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400485 },
486 },
487 "extract": { # [Pick one] Configures an extract job.
488 "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 -0700489 "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 -0400490 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700491 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000492 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400493 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
494 "A String",
495 ],
496 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800497 "projectId": "A String", # [Required] The ID of the project containing this table.
498 "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.
499 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400500 },
501 },
502 },
503 "id": "A String", # [Output-only] Opaque ID field of the job
504 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
505 }</pre>
506</div>
507
508<div class="method">
509 <code class="details" id="getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</code>
510 <pre>Retrieves the results of a query job.
511
512Args:
513 projectId: string, Project ID of the query job (required)
514 jobId: string, Job ID of the query job (required)
515 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
516 pageToken: string, Page token, returned by a previous call, to request the next page of results
517 maxResults: integer, Maximum number of results to read
518 startIndex: string, Zero-based index of the starting row
519
520Returns:
521 An object of the form:
522
523 {
524 "kind": "bigquery#getQueryResultsResponse", # The resource type of the response.
525 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000526 {
527 "f": [ # Represents a single row in the result set, consisting of one or more fields.
528 {
John Asmuth614db982014-04-24 15:46:26 -0400529 "v": "",
530 },
531 ],
532 },
533 ],
534 "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 -0800535 "projectId": "A String", # [Required] The ID of the project containing this job.
536 "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 -0400537 },
538 "pageToken": "A String", # A token used for paging results.
539 "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.
540 "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 -0800541 "totalBytesProcessed": "A String", # The total number of bytes processed for this query.
John Asmuth614db982014-04-24 15:46:26 -0400542 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
543 "etag": "A String", # A hash of this response.
544 "schema": { # The schema of the results. Present only when the query completes successfully.
545 "fields": [ # Describes the fields in a table.
546 {
547 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
548 # Object with schema name: TableFieldSchema
549 ],
550 "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 -0800551 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
552 "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 -0400553 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
554 },
555 ],
556 },
557 }</pre>
558</div>
559
560<div class="method">
561 <code class="details" id="insert">insert(projectId, body=None, media_body=None)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000562 <pre>Starts a new asynchronous job. Requires the Can View project role.
John Asmuth614db982014-04-24 15:46:26 -0400563
564Args:
565 projectId: string, Project ID of the project that will be billed for the job (required)
566 body: object, The request body.
567 The object takes the form of:
568
569{
570 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
571 "state": "A String", # [Output-only] Running state of the job.
572 "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.
573 {
574 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
575 "message": "A String", # A human-readable description of the error.
576 "reason": "A String", # A short error code that summarizes the error.
577 "location": "A String", # Specifies where the error occurred, if present.
578 },
579 ],
580 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
581 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
582 "message": "A String", # A human-readable description of the error.
583 "reason": "A String", # A short error code that summarizes the error.
584 "location": "A String", # Specifies where the error occurred, if present.
585 },
586 },
587 "kind": "bigquery#job", # [Output-only] The type of the resource.
588 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
589 "load": { # [Output-only] Statistics for a load job.
590 "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.
591 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
592 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
593 "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.
594 },
595 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
596 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
597 "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.
598 "query": { # [Output-only] Statistics for a query job.
599 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
600 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
601 },
602 "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 -0800603 "extract": { # [Output-only] Statistics for an extract job.
604 "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.
605 "A String",
606 ],
607 },
John Asmuth614db982014-04-24 15:46:26 -0400608 },
609 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800610 "projectId": "A String", # [Required] The ID of the project containing this job.
611 "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 -0400612 },
613 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800614 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400615 "configuration": { # [Required] Describes the job configuration.
616 "load": { # [Pick one] Configures a load job.
617 "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.
618 "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 (',').
619 "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.
620 "destinationTable": { # [Required] The destination table to load the data into.
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 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000625 "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_APPEND. 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.
626 "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. The default value is 0, which requires that all records are valid.
627 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400628 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000629 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400630 "A String",
631 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000632 "quote": """, # [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.
John Asmuth614db982014-04-24 15:46:26 -0400633 "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.
634 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
635 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
636 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000637 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800638 "A String",
639 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000640 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400641 "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.
642 "fields": [ # Describes the fields in a table.
643 {
644 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
645 # Object with schema name: TableFieldSchema
646 ],
647 "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 -0800648 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
649 "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 -0400650 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
651 },
652 ],
653 },
654 },
655 "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.
656 "link": { # [Pick one] Configures a link job.
657 "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.
658 "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.
659 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800660 "projectId": "A String", # [Required] The ID of the project containing this table.
661 "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.
662 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400663 },
664 "sourceUri": [ # [Required] URI of source table to link.
665 "A String",
666 ],
667 },
668 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000669 "flattenResults": true, # [Optional] 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.
670 "useQueryCache": true, # [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. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400671 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800672 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
673 "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 -0400674 },
675 "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 -0800676 "projectId": "A String", # [Required] The ID of the project containing this table.
677 "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.
678 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400679 },
680 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
681 "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 -0700682 "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 -0400683 "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.
684 "query": "A String", # [Required] BigQuery SQL query to execute.
685 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000686 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
687 "a_key": {
688 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
689 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
690 "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 (',').
691 "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.
692 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
693 "allowJaggedRows": True or False, # [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
694 "quote": """, # [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.
695 "allowQuotedNewlines": True or False, # [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
696 },
697 "sourceFormat": "A String", # [Optional] The data format. External data sources must be in CSV format. The default value is CSV.
698 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
699 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns
700 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. CSV limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
701 "A String",
702 ],
703 "schema": { # [Required] The schema for the data.
704 "fields": [ # Describes the fields in a table.
705 {
706 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
707 # Object with schema name: TableFieldSchema
708 ],
709 "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).
710 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
711 "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.
712 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
713 },
714 ],
715 },
716 },
717 },
John Asmuth614db982014-04-24 15:46:26 -0400718 },
719 "copy": { # [Pick one] Copies a table.
720 "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 -0700721 "sourceTables": [ # [Pick one] Source tables to copy.
722 {
Craig Citroe633be12015-03-02 13:40:36 -0800723 "projectId": "A String", # [Required] The ID of the project containing this table.
724 "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.
725 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700726 },
727 ],
John Asmuth614db982014-04-24 15:46:26 -0400728 "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.
729 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800730 "projectId": "A String", # [Required] The ID of the project containing this table.
731 "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.
732 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400733 },
Craig Citro065b5302014-08-14 00:47:23 -0700734 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800735 "projectId": "A String", # [Required] The ID of the project containing this table.
736 "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.
737 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400738 },
739 },
740 "extract": { # [Pick one] Configures an extract job.
741 "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 -0700742 "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 -0400743 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700744 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000745 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400746 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
747 "A String",
748 ],
749 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800750 "projectId": "A String", # [Required] The ID of the project containing this table.
751 "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.
752 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400753 },
754 },
755 },
756 "id": "A String", # [Output-only] Opaque ID field of the job
757 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
758 }
759
760 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
761
762Returns:
763 An object of the form:
764
765 {
766 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
767 "state": "A String", # [Output-only] Running state of the job.
768 "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.
769 {
770 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
771 "message": "A String", # A human-readable description of the error.
772 "reason": "A String", # A short error code that summarizes the error.
773 "location": "A String", # Specifies where the error occurred, if present.
774 },
775 ],
776 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
777 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
778 "message": "A String", # A human-readable description of the error.
779 "reason": "A String", # A short error code that summarizes the error.
780 "location": "A String", # Specifies where the error occurred, if present.
781 },
782 },
783 "kind": "bigquery#job", # [Output-only] The type of the resource.
784 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
785 "load": { # [Output-only] Statistics for a load job.
786 "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.
787 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
788 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
789 "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.
790 },
791 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
792 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
793 "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.
794 "query": { # [Output-only] Statistics for a query job.
795 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
796 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
797 },
798 "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 -0800799 "extract": { # [Output-only] Statistics for an extract job.
800 "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.
801 "A String",
802 ],
803 },
John Asmuth614db982014-04-24 15:46:26 -0400804 },
805 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800806 "projectId": "A String", # [Required] The ID of the project containing this job.
807 "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 -0400808 },
809 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800810 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400811 "configuration": { # [Required] Describes the job configuration.
812 "load": { # [Pick one] Configures a load job.
813 "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.
814 "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 (',').
815 "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.
816 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800817 "projectId": "A String", # [Required] The ID of the project containing this table.
818 "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.
819 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400820 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000821 "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_APPEND. 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.
822 "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. The default value is 0, which requires that all records are valid.
823 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400824 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000825 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400826 "A String",
827 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000828 "quote": """, # [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.
John Asmuth614db982014-04-24 15:46:26 -0400829 "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.
830 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
831 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
832 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000833 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800834 "A String",
835 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000836 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400837 "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.
838 "fields": [ # Describes the fields in a table.
839 {
840 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
841 # Object with schema name: TableFieldSchema
842 ],
843 "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 -0800844 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
845 "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 -0400846 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
847 },
848 ],
849 },
850 },
851 "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.
852 "link": { # [Pick one] Configures a link job.
853 "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.
854 "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.
855 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800856 "projectId": "A String", # [Required] The ID of the project containing this table.
857 "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.
858 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400859 },
860 "sourceUri": [ # [Required] URI of source table to link.
861 "A String",
862 ],
863 },
864 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000865 "flattenResults": true, # [Optional] 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.
866 "useQueryCache": true, # [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. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400867 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800868 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
869 "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 -0400870 },
871 "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 -0800872 "projectId": "A String", # [Required] The ID of the project containing this table.
873 "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.
874 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400875 },
876 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
877 "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 -0700878 "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 -0400879 "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.
880 "query": "A String", # [Required] BigQuery SQL query to execute.
881 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000882 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
883 "a_key": {
884 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
885 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
886 "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 (',').
887 "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.
888 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
889 "allowJaggedRows": True or False, # [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
890 "quote": """, # [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.
891 "allowQuotedNewlines": True or False, # [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
892 },
893 "sourceFormat": "A String", # [Optional] The data format. External data sources must be in CSV format. The default value is CSV.
894 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
895 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns
896 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. CSV limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
897 "A String",
898 ],
899 "schema": { # [Required] The schema for the data.
900 "fields": [ # Describes the fields in a table.
901 {
902 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
903 # Object with schema name: TableFieldSchema
904 ],
905 "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).
906 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
907 "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.
908 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
909 },
910 ],
911 },
912 },
913 },
John Asmuth614db982014-04-24 15:46:26 -0400914 },
915 "copy": { # [Pick one] Copies a table.
916 "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 -0700917 "sourceTables": [ # [Pick one] Source tables to copy.
918 {
Craig Citroe633be12015-03-02 13:40:36 -0800919 "projectId": "A String", # [Required] The ID of the project containing this table.
920 "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.
921 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700922 },
923 ],
John Asmuth614db982014-04-24 15:46:26 -0400924 "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.
925 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800926 "projectId": "A String", # [Required] The ID of the project containing this table.
927 "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.
928 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400929 },
Craig Citro065b5302014-08-14 00:47:23 -0700930 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800931 "projectId": "A String", # [Required] The ID of the project containing this table.
932 "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.
933 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400934 },
935 },
936 "extract": { # [Pick one] Configures an extract job.
937 "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 -0700938 "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 -0400939 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700940 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000941 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400942 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
943 "A String",
944 ],
945 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800946 "projectId": "A String", # [Required] The ID of the project containing this table.
947 "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.
948 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400949 },
950 },
951 },
952 "id": "A String", # [Output-only] Opaque ID field of the job
953 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
954 }</pre>
955</div>
956
957<div class="method">
958 <code class="details" id="list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000959 <pre>Lists all jobs that you started in the specified project. The job list returns in reverse chronological order of when the jobs were created, starting with the most recent job created. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.
John Asmuth614db982014-04-24 15:46:26 -0400960
961Args:
962 projectId: string, Project ID of the jobs to list (required)
963 projection: string, Restrict information returned to a set of selected fields
964 Allowed values
965 full - Includes all job data
966 minimal - Does not include the job configuration
967 stateFilter: string, Filter for job state (repeated)
968 Allowed values
969 done - Finished jobs
970 pending - Pending jobs
971 running - Running jobs
972 pageToken: string, Page token, returned by a previous call, to request the next page of results
973 allUsers: boolean, Whether to display jobs owned by all users in the project. Default false
974 maxResults: integer, Maximum number of results to return
975
976Returns:
977 An object of the form:
978
979 {
980 "nextPageToken": "A String", # A token to request the next page of results.
John Asmuth614db982014-04-24 15:46:26 -0400981 "kind": "bigquery#jobList", # The resource type of the response.
982 "etag": "A String", # A hash of this page of results.
983 "jobs": [ # List of jobs that were requested.
984 {
985 "status": { # [Full-projection-only] Describes the state of the job.
986 "state": "A String", # [Output-only] Running state of the job.
987 "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.
988 {
989 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
990 "message": "A String", # A human-readable description of the error.
991 "reason": "A String", # A short error code that summarizes the error.
992 "location": "A String", # Specifies where the error occurred, if present.
993 },
994 ],
995 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
996 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
997 "message": "A String", # A human-readable description of the error.
998 "reason": "A String", # A short error code that summarizes the error.
999 "location": "A String", # Specifies where the error occurred, if present.
1000 },
1001 },
1002 "kind": "bigquery#job", # The resource type.
1003 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
1004 "load": { # [Output-only] Statistics for a load job.
1005 "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.
1006 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
1007 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a joad job.
1008 "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.
1009 },
1010 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
1011 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
1012 "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.
1013 "query": { # [Output-only] Statistics for a query job.
1014 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
1015 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for this job.
1016 },
1017 "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 -08001018 "extract": { # [Output-only] Statistics for an extract job.
1019 "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.
1020 "A String",
1021 ],
1022 },
John Asmuth614db982014-04-24 15:46:26 -04001023 },
1024 "jobReference": { # Job reference uniquely identifying the job.
Craig Citroe633be12015-03-02 13:40:36 -08001025 "projectId": "A String", # [Required] The ID of the project containing this job.
1026 "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 -04001027 },
1028 "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 -08001029 "user_email": "A String", # [Full-projection-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04001030 "configuration": { # [Full-projection-only] Specifies the job configuration.
1031 "load": { # [Pick one] Configures a load job.
1032 "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.
1033 "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 (',').
1034 "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.
1035 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -08001036 "projectId": "A String", # [Required] The ID of the project containing this table.
1037 "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.
1038 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001039 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001040 "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_APPEND. 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.
1041 "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. The default value is 0, which requires that all records are valid.
1042 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -04001043 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001044 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -04001045 "A String",
1046 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001047 "quote": """, # [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.
John Asmuth614db982014-04-24 15:46:26 -04001048 "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.
1049 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
1050 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
1051 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001052 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -08001053 "A String",
1054 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001055 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -04001056 "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.
1057 "fields": [ # Describes the fields in a table.
1058 {
1059 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1060 # Object with schema name: TableFieldSchema
1061 ],
1062 "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 -08001063 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1064 "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 -04001065 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1066 },
1067 ],
1068 },
1069 },
1070 "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.
1071 "link": { # [Pick one] Configures a link job.
1072 "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.
1073 "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.
1074 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -08001075 "projectId": "A String", # [Required] The ID of the project containing this table.
1076 "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.
1077 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001078 },
1079 "sourceUri": [ # [Required] URI of source table to link.
1080 "A String",
1081 ],
1082 },
1083 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001084 "flattenResults": true, # [Optional] 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.
1085 "useQueryCache": true, # [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. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -04001086 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -08001087 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1088 "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 -04001089 },
1090 "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 -08001091 "projectId": "A String", # [Required] The ID of the project containing this table.
1092 "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.
1093 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001094 },
1095 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
1096 "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 -07001097 "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 -04001098 "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.
1099 "query": "A String", # [Required] BigQuery SQL query to execute.
1100 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001101 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
1102 "a_key": {
1103 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
1104 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
1105 "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 (',').
1106 "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.
1107 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
1108 "allowJaggedRows": True or False, # [Optional] Indicates if BigQuery should accept rows that are missing trailing optional columns. If true, BigQuery treats missing trailing columns as null values. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false.
1109 "quote": """, # [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.
1110 "allowQuotedNewlines": True or False, # [Optional] Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
1111 },
1112 "sourceFormat": "A String", # [Optional] The data format. External data sources must be in CSV format. The default value is CSV.
1113 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
1114 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns
1115 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. CSV limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
1116 "A String",
1117 ],
1118 "schema": { # [Required] The schema for the data.
1119 "fields": [ # Describes the fields in a table.
1120 {
1121 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1122 # Object with schema name: TableFieldSchema
1123 ],
1124 "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).
1125 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1126 "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.
1127 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1128 },
1129 ],
1130 },
1131 },
1132 },
John Asmuth614db982014-04-24 15:46:26 -04001133 },
1134 "copy": { # [Pick one] Copies a table.
1135 "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 -07001136 "sourceTables": [ # [Pick one] Source tables to copy.
1137 {
Craig Citroe633be12015-03-02 13:40:36 -08001138 "projectId": "A String", # [Required] The ID of the project containing this table.
1139 "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.
1140 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -07001141 },
1142 ],
John Asmuth614db982014-04-24 15:46:26 -04001143 "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.
1144 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -08001145 "projectId": "A String", # [Required] The ID of the project containing this table.
1146 "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.
1147 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001148 },
Craig Citro065b5302014-08-14 00:47:23 -07001149 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -08001150 "projectId": "A String", # [Required] The ID of the project containing this table.
1151 "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.
1152 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001153 },
1154 },
1155 "extract": { # [Pick one] Configures an extract job.
1156 "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 -07001157 "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 -04001158 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -07001159 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001160 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -04001161 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
1162 "A String",
1163 ],
1164 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -08001165 "projectId": "A String", # [Required] The ID of the project containing this table.
1166 "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.
1167 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001168 },
1169 },
1170 },
1171 "id": "A String", # Unique opaque ID of the job.
1172 "errorResult": { # A result object that will be present only if the job has failed.
1173 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1174 "message": "A String", # A human-readable description of the error.
1175 "reason": "A String", # A short error code that summarizes the error.
1176 "location": "A String", # Specifies where the error occurred, if present.
1177 },
1178 },
1179 ],
1180 }</pre>
1181</div>
1182
1183<div class="method">
1184 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
1185 <pre>Retrieves the next page of results.
1186
1187Args:
1188 previous_request: The request for the previous page. (required)
1189 previous_response: The response from the request for the previous page. (required)
1190
1191Returns:
1192 A request object that you can call 'execute()' on to request the next
1193 page. Returns None if there are no more items in the collection.
1194 </pre>
1195</div>
1196
1197<div class="method">
1198 <code class="details" id="query">query(projectId, body)</code>
1199 <pre>Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
1200
1201Args:
1202 projectId: string, Project ID of the project billed for the query (required)
1203 body: object, The request body. (required)
1204 The object takes the form of:
1205
1206{
1207 "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).
1208 "kind": "bigquery#queryRequest", # The resource type of the request.
Craig Citroe633be12015-03-02 13:40:36 -08001209 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001210 "useQueryCache": true, # [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.
John Asmuth614db982014-04-24 15:46:26 -04001211 "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 -08001212 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1213 "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 -04001214 },
1215 "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.
1216 "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 -07001217 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
John Asmuth614db982014-04-24 15:46:26 -04001218 }
1219
1220
1221Returns:
1222 An object of the form:
1223
1224 {
1225 "kind": "bigquery#queryResponse", # The resource type.
1226 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001227 {
1228 "f": [ # Represents a single row in the result set, consisting of one or more fields.
1229 {
John Asmuth614db982014-04-24 15:46:26 -04001230 "v": "",
1231 },
1232 ],
1233 },
1234 ],
1235 "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 -08001236 "projectId": "A String", # [Required] The ID of the project containing this job.
1237 "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 -04001238 },
1239 "pageToken": "A String", # A token used for paging results.
1240 "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.
1241 "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.
1242 "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.
1243 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
1244 "schema": { # The schema of the results. Present only when the query completes successfully.
1245 "fields": [ # Describes the fields in a table.
1246 {
1247 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1248 # Object with schema name: TableFieldSchema
1249 ],
1250 "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 -08001251 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1252 "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 -04001253 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1254 },
1255 ],
1256 },
1257 }</pre>
1258</div>
1259
1260</body></html>