blob: 0bd365ee8796a219e457b201ac3ec5d8981ca177 [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">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070078 <code><a href="#cancel">cancel(projectId, jobId, location=None)</a></code></p>
Takashi Matsuo06694102015-09-11 13:55:40 -070079<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. Cancelled jobs may still incur costs.</p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000080<p class="toc_element">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070081 <code><a href="#get">get(projectId, jobId, location=None)</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">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070084 <code><a href="#getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None, location=None)</a></code></p>
John Asmuth614db982014-04-24 15:46:26 -040085<p class="firstline">Retrieves the results of a query job.</p>
86<p class="toc_element">
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -040087 <code><a href="#getQueryResults_next">getQueryResults_next(previous_request, previous_response)</a></code></p>
88<p class="firstline">Retrieves the next page of results.</p>
89<p class="toc_element">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -080090 <code><a href="#insert">insert(projectId, body=None, media_body=None, media_mime_type=None)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000091<p class="firstline">Starts a new asynchronous job. Requires the Can View project role.</p>
John Asmuth614db982014-04-24 15:46:26 -040092<p class="toc_element">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070093 <code><a href="#list">list(projectId, maxCreationTime=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None, minCreationTime=None, projection=None)</a></code></p>
Takashi Matsuo06694102015-09-11 13:55:40 -070094<p class="firstline">Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. 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 -040095<p class="toc_element">
96 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
97<p class="firstline">Retrieves the next page of results.</p>
98<p class="toc_element">
99 <code><a href="#query">query(projectId, body)</a></code></p>
100<p class="firstline">Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.</p>
101<h3>Method Details</h3>
102<div class="method">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700103 <code class="details" id="cancel">cancel(projectId, jobId, location=None)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -0700104 <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. Cancelled jobs may still incur costs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000105
106Args:
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800107 projectId: string, [Required] Project ID of the job to cancel (required)
108 jobId: string, [Required] Job ID of the job to cancel (required)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700109 location: string, The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000110
111Returns:
112 An object of the form:
113
114 {
115 "job": { # The final state of the job.
116 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
117 "state": "A String", # [Output-only] Running state of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700118 "errors": [ # [Output-only] The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000119 {
120 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
121 "message": "A String", # A human-readable description of the error.
122 "reason": "A String", # A short error code that summarizes the error.
123 "location": "A String", # Specifies where the error occurred, if present.
124 },
125 ],
126 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
127 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
128 "message": "A String", # A human-readable description of the error.
129 "reason": "A String", # A short error code that summarizes the error.
130 "location": "A String", # Specifies where the error occurred, if present.
131 },
132 },
133 "kind": "bigquery#job", # [Output-only] The type of the resource.
134 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
135 "load": { # [Output-only] Statistics for a load job.
136 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700137 "badRecords": "A String", # [Output-only] The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000138 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700139 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
140 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000141 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700142 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
143 "numChildJobs": "A String", # [Output-only] Number of child jobs executed.
144 "parentJobId": "A String", # [Output-only] If this is a child job, the id of the parent.
145 "completionRatio": 3.14, # [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
146 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
147 {
148 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
149 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
150 },
151 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000152 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
153 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700154 "quotaDeferments": [ # [Output-only] Quotas which delayed this job's start time.
155 "A String",
156 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000157 "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.
158 "query": { # [Output-only] Statistics for a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700159 "totalPartitionsProcessed": "A String", # [Output-only] Total number of partitions processed from all partitioned tables referenced in the job.
160 "totalBytesProcessedAccuracy": "A String", # [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
161 "undeclaredQueryParameters": [ # Standard SQL only: list of undeclared query parameters detected during a dry run validation.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800162 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700163 "parameterType": { # [Required] The type of this parameter.
164 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
165 {
166 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
167 "name": "A String", # [Optional] The name of this field.
168 "description": "A String", # [Optional] Human-oriented description of the field.
169 },
170 ],
171 "type": "A String", # [Required] The top level type of this field.
172 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
173 },
174 "parameterValue": { # [Required] The value of this parameter.
175 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
176 "a_key": # Object with schema name: QueryParameterValue
177 },
178 "arrayValues": [ # [Optional] The array values, if this is an array type.
179 # Object with schema name: QueryParameterValue
180 ],
181 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
182 },
183 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
184 },
185 ],
186 "modelTrainingCurrentIteration": 42, # [Output-only, Beta] Deprecated; do not use.
187 "modelTrainingExpectedTotalIteration": "A String", # [Output-only, Beta] Deprecated; do not use.
188 "estimatedBytesProcessed": "A String", # [Output-only] The original estimate of bytes processed for the job.
189 "ddlTargetRoutine": { # The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
190 "projectId": "A String", # [Required] The ID of the project containing this routine.
191 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
192 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
193 },
194 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
195 "billingTier": 42, # [Output-only] Billing tier for the job.
196 "referencedTables": [ # [Output-only] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
197 {
198 "projectId": "A String", # [Required] The ID of the project containing this table.
199 "tableId": "A String", # [Required] The ID of the table. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.
200 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
201 },
202 ],
203 "schema": { # [Output-only] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
204 "fields": [ # Describes the fields in a table.
205 {
206 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
207 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
208 # Object with schema name: TableFieldSchema
209 ],
210 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
211 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
212 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
213 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
214 "A String",
215 ],
216 },
217 "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.
218 },
219 ],
220 },
221 "timeline": [ # [Output-only] [Beta] Describes a timeline of job execution.
222 {
223 "pendingUnits": "A String", # Total parallel units of work remaining for the active stages.
224 "activeUnits": "A String", # Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
225 "elapsedMs": "A String", # Milliseconds elapsed since the start of query execution.
226 "completedUnits": "A String", # Total parallel units of work completed by this query.
227 "totalSlotMs": "A String", # Cumulative slot-ms consumed by the query.
228 },
229 ],
230 "statementType": "A String", # The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "CREATE_MODEL": CREATE [OR REPLACE] MODEL ... AS SELECT ... . "CREATE_PROCEDURE": CREATE PROCEDURE query. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_FUNCTION" : DROP FUNCTION query. "DROP_PROCEDURE": DROP PROCEDURE query. "DROP_TABLE": DROP TABLE query. "DROP_VIEW": DROP VIEW query.
231 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
232 {
233 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
234 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
235 },
236 ],
237 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
238 "modelTraining": { # [Output-only, Beta] Information about create model query job progress.
239 "currentIteration": 42, # [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
240 "expectedTotalIterations": "A String", # [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop.
241 },
242 "ddlTargetTable": { # The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries.
243 "projectId": "A String", # [Required] The ID of the project containing this table.
244 "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.
245 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
246 },
247 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
248 "queryPlan": [ # [Output-only] Describes execution plan for the query.
249 {
250 "computeMsMax": "A String", # Milliseconds the slowest shard spent on CPU-bound tasks.
251 "inputStages": [ # IDs for stages that are inputs to this stage.
252 "A String",
253 ],
254 "waitMsAvg": "A String", # Milliseconds the average shard spent waiting to be scheduled.
255 "id": "A String", # Unique ID for stage within plan.
256 "endMs": "A String", # Stage end time represented as milliseconds since epoch.
257 "waitMsMax": "A String", # Milliseconds the slowest shard spent waiting to be scheduled.
258 "readMsMax": "A String", # Milliseconds the slowest shard spent reading input.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800259 "waitRatioMax": 3.14, # Relative amount of time the slowest shard spent waiting to be scheduled.
260 "readRatioAvg": 3.14, # Relative amount of time the average shard spent reading input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700261 "parallelInputs": "A String", # Number of parallel input segments to be processed.
262 "recordsRead": "A String", # Number of records read into the stage.
263 "computeRatioAvg": 3.14, # Relative amount of time the average shard spent on CPU-bound tasks.
264 "writeMsAvg": "A String", # Milliseconds the average shard spent on writing output.
265 "writeMsMax": "A String", # Milliseconds the slowest shard spent on writing output.
266 "status": "A String", # Current status for the stage.
267 "startMs": "A String", # Stage start time represented as milliseconds since epoch.
268 "computeMsAvg": "A String", # Milliseconds the average shard spent on CPU-bound tasks.
269 "shuffleOutputBytesSpilled": "A String", # Total number of bytes written to shuffle and spilled to disk.
270 "writeRatioMax": 3.14, # Relative amount of time the slowest shard spent on writing output.
271 "readMsAvg": "A String", # Milliseconds the average shard spent reading input.
272 "waitRatioAvg": 3.14, # Relative amount of time the average shard spent waiting to be scheduled.
273 "completedParallelInputs": "A String", # Number of parallel input segments completed.
274 "computeRatioMax": 3.14, # Relative amount of time the slowest shard spent on CPU-bound tasks.
275 "name": "A String", # Human-readable name for stage.
276 "shuffleOutputBytes": "A String", # Total number of bytes written to shuffle.
277 "recordsWritten": "A String", # Number of records written by the stage.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800278 "readRatioMax": 3.14, # Relative amount of time the slowest shard spent reading input.
279 "steps": [ # List of operations within the stage in dependency order (approximately chronological).
280 {
281 "kind": "A String", # Machine-readable operation type.
282 "substeps": [ # Human-readable stage descriptions.
283 "A String",
284 ],
285 },
286 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800287 "writeRatioAvg": 3.14, # Relative amount of time the average shard spent on writing output.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800288 },
289 ],
Takashi Matsuo06694102015-09-11 13:55:40 -0700290 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700291 "ddlOperationPerformed": "A String", # The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target.
292 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000293 },
294 "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.
295 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700296 "destinationUriFileCounts": [ # [Output-only] 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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000297 "A String",
298 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700299 "inputBytes": "A String", # [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000300 },
301 },
302 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
303 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700304 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000305 "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.
306 },
307 "etag": "A String", # [Output-only] A hash of this resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700308 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000309 "configuration": { # [Required] Describes the job configuration.
310 "load": { # [Pick one] Configures a load job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700311 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
312 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
313 },
314 "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.
315 "destinationTableProperties": { # [Beta] [Optional] Properties with which to create the destination table if it is new.
316 "friendlyName": "A String", # [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail.
317 "labels": { # [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
318 "a_key": "A String",
319 },
320 "description": "A String", # [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
321 },
322 "autodetect": True or False, # [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
323 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
324 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
325 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
326 "requirePartitionFilter": True or False,
327 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
328 },
329 "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.
330 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
331 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
332 "A String",
333 ],
334 },
335 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. 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 (',').
336 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
337 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
338 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
339 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
340 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
341 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
342 },
343 },
344 "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. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid.
345 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800346 "A String",
347 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700348 "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
349 "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.
350 "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.
351 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
352 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
353 "fields": [ # Describes the fields in a table.
354 {
355 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
356 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
357 # Object with schema name: TableFieldSchema
358 ],
359 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
360 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
361 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
362 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
363 "A String",
364 ],
365 },
366 "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.
367 },
368 ],
369 },
370 "useAvroLogicalTypes": True or False, # [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER).
371 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000372 "destinationTable": { # [Required] The destination table to load the data into.
373 "projectId": "A String", # [Required] The ID of the project containing this table.
374 "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.
375 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
376 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700377 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
378 "A String",
379 ],
380 "projectionFields": [ # 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.
381 "A String",
382 ],
383 "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". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
384 "nullMarker": "A String", # [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000385 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700386 "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.
387 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000388 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000389 },
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800390 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700391 "labels": { # The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700392 "a_key": "A String",
393 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700394 "jobTimeoutMs": "A String", # [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800395 "query": { # [Pick one] Configures a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700396 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
397 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
398 },
399 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
400 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
401 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
402 "requirePartitionFilter": True or False,
403 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
404 },
405 "query": "A String", # [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL.
406 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
407 "maximumBytesBilled": "A String", # [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
408 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
409 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
410 "A String",
411 ],
412 },
413 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
414 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800415 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
416 "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.
417 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700418 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
419 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
420 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
421 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
422 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
423 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
424 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000425 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700426 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700427 "A String",
428 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800429 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700430 "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 "userDefinedFunctionResources": [ # Describes user-defined function resources used in the query.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700432 {
433 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
434 "inlineCode": "A String", # [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
435 },
436 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700437 "flattenResults": true, # [Optional] If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.
438 "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.
439 "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. This property must be set for large results that exceed the maximum response size.
440 "projectId": "A String", # [Required] The ID of the project containing this table.
441 "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.
442 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
443 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700444 "queryParameters": [ # Query parameters for standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700445 {
446 "parameterType": { # [Required] The type of this parameter.
447 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
448 {
449 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700450 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700451 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700452 },
453 ],
454 "type": "A String", # [Required] The top level type of this field.
455 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
456 },
457 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -0700458 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
459 "a_key": # Object with schema name: QueryParameterValue
460 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700461 "arrayValues": [ # [Optional] The array values, if this is an array type.
462 # Object with schema name: QueryParameterValue
463 ],
464 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
465 },
466 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
467 },
468 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700469 "maximumBillingTier": 1, # [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.
470 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
471 "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 and uses the schema from the query result. 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.
472 "allowLargeResults": false, # [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800473 "tableDefinitions": { # [Optional] 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.
474 "a_key": {
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700475 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800476 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
477 "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 (',').
478 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800479 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700480 "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.
481 "skipLeadingRows": "A String", # [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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800482 "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.
483 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700484 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
485 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
486 "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. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700487 "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 Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700488 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800489 "A String",
490 ],
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700491 "bigtableOptions": { # [Optional] Additional options if sourceFormat is set to BIGTABLE.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700492 "readRowkeyAsString": True or False, # [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700493 "ignoreUnspecifiedColumnFamilies": True or False, # [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
494 "columnFamilies": [ # [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
495 {
496 "familyId": "A String", # Identifier of the column family.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700497 "type": "A String", # [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700498 "onlyReadLatest": True or False, # [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
499 "columns": [ # [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
500 {
501 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
502 "qualifierEncoded": "A String", # [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
503 "fieldName": "A String", # [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
504 "onlyReadLatest": True or False, # [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
505 "qualifierString": "A String",
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700506 "type": "A String", # [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700507 },
508 ],
509 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
510 },
511 ],
512 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700513 "autodetect": True or False, # Try to detect schema and format options automatically. Any option specified explicitly will be honored.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700514 "googleSheetsOptions": { # [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
515 "skipLeadingRows": "A String", # [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700516 "range": "A String", # [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700517 },
518 "schema": { # [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800519 "fields": [ # Describes the fields in a table.
520 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700521 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800522 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
523 # Object with schema name: TableFieldSchema
524 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800525 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700526 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
527 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
528 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
529 "A String",
530 ],
531 },
532 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800533 },
534 ],
535 },
536 },
537 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000538 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700539 "copy": { # [Pick one] Copies a table.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700540 "sourceTables": [ # [Pick one] Source tables to copy.
541 {
542 "projectId": "A String", # [Required] The ID of the project containing this table.
543 "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.
544 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
545 },
546 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700547 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
548 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
549 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700550 "destinationTable": { # [Required] The destination table
551 "projectId": "A String", # [Required] The ID of the project containing this table.
552 "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.
553 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
554 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700555 "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.
556 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700557 "sourceTable": { # [Pick one] Source table to copy.
558 "projectId": "A String", # [Required] The ID of the project containing this table.
559 "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.
560 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
561 },
562 },
563 "extract": { # [Pick one] Configures an extract job.
564 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700565 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700566 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
567 "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.
568 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
569 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
570 "A String",
571 ],
572 "sourceTable": { # [Required] A reference to the table being exported.
573 "projectId": "A String", # [Required] The ID of the project containing this table.
574 "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.
575 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
576 },
577 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700578 "jobType": "A String", # [Output-only] The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000579 },
580 "id": "A String", # [Output-only] Opaque ID field of the job
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700581 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000582 },
583 "kind": "bigquery#jobCancelResponse", # The resource type of the response.
584 }</pre>
585</div>
586
587<div class="method">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700588 <code class="details" id="get">get(projectId, jobId, location=None)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000589 <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 -0400590
591Args:
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800592 projectId: string, [Required] Project ID of the requested job (required)
593 jobId: string, [Required] Job ID of the requested job (required)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700594 location: string, The geographic location of the job. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
John Asmuth614db982014-04-24 15:46:26 -0400595
596Returns:
597 An object of the form:
598
599 {
600 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
601 "state": "A String", # [Output-only] Running state of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700602 "errors": [ # [Output-only] The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
John Asmuth614db982014-04-24 15:46:26 -0400603 {
604 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
605 "message": "A String", # A human-readable description of the error.
606 "reason": "A String", # A short error code that summarizes the error.
607 "location": "A String", # Specifies where the error occurred, if present.
608 },
609 ],
610 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
611 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
612 "message": "A String", # A human-readable description of the error.
613 "reason": "A String", # A short error code that summarizes the error.
614 "location": "A String", # Specifies where the error occurred, if present.
615 },
616 },
617 "kind": "bigquery#job", # [Output-only] The type of the resource.
618 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
619 "load": { # [Output-only] Statistics for a load job.
620 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700621 "badRecords": "A String", # [Output-only] The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
John Asmuth614db982014-04-24 15:46:26 -0400622 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700623 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
624 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
John Asmuth614db982014-04-24 15:46:26 -0400625 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700626 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
627 "numChildJobs": "A String", # [Output-only] Number of child jobs executed.
628 "parentJobId": "A String", # [Output-only] If this is a child job, the id of the parent.
629 "completionRatio": 3.14, # [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
630 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
631 {
632 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
633 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
634 },
635 ],
John Asmuth614db982014-04-24 15:46:26 -0400636 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
637 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700638 "quotaDeferments": [ # [Output-only] Quotas which delayed this job's start time.
639 "A String",
640 ],
John Asmuth614db982014-04-24 15:46:26 -0400641 "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.
642 "query": { # [Output-only] Statistics for a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700643 "totalPartitionsProcessed": "A String", # [Output-only] Total number of partitions processed from all partitioned tables referenced in the job.
644 "totalBytesProcessedAccuracy": "A String", # [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
645 "undeclaredQueryParameters": [ # Standard SQL only: list of undeclared query parameters detected during a dry run validation.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800646 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700647 "parameterType": { # [Required] The type of this parameter.
648 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
649 {
650 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
651 "name": "A String", # [Optional] The name of this field.
652 "description": "A String", # [Optional] Human-oriented description of the field.
653 },
654 ],
655 "type": "A String", # [Required] The top level type of this field.
656 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
657 },
658 "parameterValue": { # [Required] The value of this parameter.
659 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
660 "a_key": # Object with schema name: QueryParameterValue
661 },
662 "arrayValues": [ # [Optional] The array values, if this is an array type.
663 # Object with schema name: QueryParameterValue
664 ],
665 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
666 },
667 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
668 },
669 ],
670 "modelTrainingCurrentIteration": 42, # [Output-only, Beta] Deprecated; do not use.
671 "modelTrainingExpectedTotalIteration": "A String", # [Output-only, Beta] Deprecated; do not use.
672 "estimatedBytesProcessed": "A String", # [Output-only] The original estimate of bytes processed for the job.
673 "ddlTargetRoutine": { # The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
674 "projectId": "A String", # [Required] The ID of the project containing this routine.
675 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
676 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
677 },
678 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
679 "billingTier": 42, # [Output-only] Billing tier for the job.
680 "referencedTables": [ # [Output-only] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
681 {
682 "projectId": "A String", # [Required] The ID of the project containing this table.
683 "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.
684 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
685 },
686 ],
687 "schema": { # [Output-only] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
688 "fields": [ # Describes the fields in a table.
689 {
690 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
691 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
692 # Object with schema name: TableFieldSchema
693 ],
694 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
695 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
696 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
697 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
698 "A String",
699 ],
700 },
701 "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.
702 },
703 ],
704 },
705 "timeline": [ # [Output-only] [Beta] Describes a timeline of job execution.
706 {
707 "pendingUnits": "A String", # Total parallel units of work remaining for the active stages.
708 "activeUnits": "A String", # Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
709 "elapsedMs": "A String", # Milliseconds elapsed since the start of query execution.
710 "completedUnits": "A String", # Total parallel units of work completed by this query.
711 "totalSlotMs": "A String", # Cumulative slot-ms consumed by the query.
712 },
713 ],
714 "statementType": "A String", # The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "CREATE_MODEL": CREATE [OR REPLACE] MODEL ... AS SELECT ... . "CREATE_PROCEDURE": CREATE PROCEDURE query. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_FUNCTION" : DROP FUNCTION query. "DROP_PROCEDURE": DROP PROCEDURE query. "DROP_TABLE": DROP TABLE query. "DROP_VIEW": DROP VIEW query.
715 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
716 {
717 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
718 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
719 },
720 ],
721 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
722 "modelTraining": { # [Output-only, Beta] Information about create model query job progress.
723 "currentIteration": 42, # [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
724 "expectedTotalIterations": "A String", # [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop.
725 },
726 "ddlTargetTable": { # The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries.
727 "projectId": "A String", # [Required] The ID of the project containing this table.
728 "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.
729 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
730 },
731 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
732 "queryPlan": [ # [Output-only] Describes execution plan for the query.
733 {
734 "computeMsMax": "A String", # Milliseconds the slowest shard spent on CPU-bound tasks.
735 "inputStages": [ # IDs for stages that are inputs to this stage.
736 "A String",
737 ],
738 "waitMsAvg": "A String", # Milliseconds the average shard spent waiting to be scheduled.
739 "id": "A String", # Unique ID for stage within plan.
740 "endMs": "A String", # Stage end time represented as milliseconds since epoch.
741 "waitMsMax": "A String", # Milliseconds the slowest shard spent waiting to be scheduled.
742 "readMsMax": "A String", # Milliseconds the slowest shard spent reading input.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800743 "waitRatioMax": 3.14, # Relative amount of time the slowest shard spent waiting to be scheduled.
744 "readRatioAvg": 3.14, # Relative amount of time the average shard spent reading input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700745 "parallelInputs": "A String", # Number of parallel input segments to be processed.
746 "recordsRead": "A String", # Number of records read into the stage.
747 "computeRatioAvg": 3.14, # Relative amount of time the average shard spent on CPU-bound tasks.
748 "writeMsAvg": "A String", # Milliseconds the average shard spent on writing output.
749 "writeMsMax": "A String", # Milliseconds the slowest shard spent on writing output.
750 "status": "A String", # Current status for the stage.
751 "startMs": "A String", # Stage start time represented as milliseconds since epoch.
752 "computeMsAvg": "A String", # Milliseconds the average shard spent on CPU-bound tasks.
753 "shuffleOutputBytesSpilled": "A String", # Total number of bytes written to shuffle and spilled to disk.
754 "writeRatioMax": 3.14, # Relative amount of time the slowest shard spent on writing output.
755 "readMsAvg": "A String", # Milliseconds the average shard spent reading input.
756 "waitRatioAvg": 3.14, # Relative amount of time the average shard spent waiting to be scheduled.
757 "completedParallelInputs": "A String", # Number of parallel input segments completed.
758 "computeRatioMax": 3.14, # Relative amount of time the slowest shard spent on CPU-bound tasks.
759 "name": "A String", # Human-readable name for stage.
760 "shuffleOutputBytes": "A String", # Total number of bytes written to shuffle.
761 "recordsWritten": "A String", # Number of records written by the stage.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800762 "readRatioMax": 3.14, # Relative amount of time the slowest shard spent reading input.
763 "steps": [ # List of operations within the stage in dependency order (approximately chronological).
764 {
765 "kind": "A String", # Machine-readable operation type.
766 "substeps": [ # Human-readable stage descriptions.
767 "A String",
768 ],
769 },
770 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800771 "writeRatioAvg": 3.14, # Relative amount of time the average shard spent on writing output.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800772 },
773 ],
Takashi Matsuo06694102015-09-11 13:55:40 -0700774 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700775 "ddlOperationPerformed": "A String", # The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target.
776 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -0400777 },
778 "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 -0800779 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700780 "destinationUriFileCounts": [ # [Output-only] 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.
Craig Citroe633be12015-03-02 13:40:36 -0800781 "A String",
782 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700783 "inputBytes": "A String", # [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes.
Craig Citroe633be12015-03-02 13:40:36 -0800784 },
John Asmuth614db982014-04-24 15:46:26 -0400785 },
786 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800787 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700788 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Craig Citroe633be12015-03-02 13:40:36 -0800789 "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 -0400790 },
791 "etag": "A String", # [Output-only] A hash of this resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700792 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
John Asmuth614db982014-04-24 15:46:26 -0400793 "configuration": { # [Required] Describes the job configuration.
794 "load": { # [Pick one] Configures a load job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700795 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
796 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
797 },
798 "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.
799 "destinationTableProperties": { # [Beta] [Optional] Properties with which to create the destination table if it is new.
800 "friendlyName": "A String", # [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail.
801 "labels": { # [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
802 "a_key": "A String",
803 },
804 "description": "A String", # [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
805 },
806 "autodetect": True or False, # [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
807 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
808 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
809 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
810 "requirePartitionFilter": True or False,
811 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
812 },
813 "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.
814 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
815 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
816 "A String",
817 ],
818 },
819 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. 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 (',').
820 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
821 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
822 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
823 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
824 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
825 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
826 },
827 },
828 "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. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid.
829 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -0800830 "A String",
831 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700832 "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
833 "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.
834 "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.
835 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
836 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
837 "fields": [ # Describes the fields in a table.
838 {
839 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
840 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
841 # Object with schema name: TableFieldSchema
842 ],
843 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
844 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
845 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
846 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
847 "A String",
848 ],
849 },
850 "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.
851 },
852 ],
853 },
854 "useAvroLogicalTypes": True or False, # [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER).
855 "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 -0400856 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800857 "projectId": "A String", # [Required] The ID of the project containing this table.
858 "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.
859 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400860 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700861 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
862 "A String",
863 ],
864 "projectionFields": [ # 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.
865 "A String",
866 ],
867 "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". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
868 "nullMarker": "A String", # [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000869 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700870 "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.
871 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
John Asmuth614db982014-04-24 15:46:26 -0400872 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
John Asmuth614db982014-04-24 15:46:26 -0400873 },
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800874 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700875 "labels": { # The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700876 "a_key": "A String",
877 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700878 "jobTimeoutMs": "A String", # [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800879 "query": { # [Pick one] Configures a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700880 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
881 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
882 },
883 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
884 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
885 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
886 "requirePartitionFilter": True or False,
887 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
888 },
889 "query": "A String", # [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL.
890 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
891 "maximumBytesBilled": "A String", # [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
892 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
893 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
894 "A String",
895 ],
896 },
897 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
898 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800899 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
900 "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.
901 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700902 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
903 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
904 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
905 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
906 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
907 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
908 },
John Asmuth614db982014-04-24 15:46:26 -0400909 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700910 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700911 "A String",
912 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800913 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700914 "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.
915 "userDefinedFunctionResources": [ # Describes user-defined function resources used in the query.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700916 {
917 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
918 "inlineCode": "A String", # [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
919 },
920 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700921 "flattenResults": true, # [Optional] If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.
922 "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.
923 "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. This property must be set for large results that exceed the maximum response size.
924 "projectId": "A String", # [Required] The ID of the project containing this table.
925 "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.
926 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
927 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -0700928 "queryParameters": [ # Query parameters for standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700929 {
930 "parameterType": { # [Required] The type of this parameter.
931 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
932 {
933 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700934 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700935 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700936 },
937 ],
938 "type": "A String", # [Required] The top level type of this field.
939 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
940 },
941 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -0700942 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
943 "a_key": # Object with schema name: QueryParameterValue
944 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -0700945 "arrayValues": [ # [Optional] The array values, if this is an array type.
946 # Object with schema name: QueryParameterValue
947 ],
948 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
949 },
950 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
951 },
952 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700953 "maximumBillingTier": 1, # [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.
954 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
955 "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 and uses the schema from the query result. 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.
956 "allowLargeResults": false, # [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800957 "tableDefinitions": { # [Optional] 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.
958 "a_key": {
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700959 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800960 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
961 "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 (',').
962 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800963 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700964 "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.
965 "skipLeadingRows": "A String", # [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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800966 "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.
967 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700968 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
969 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
970 "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. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700971 "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 Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700972 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -0800973 "A String",
974 ],
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700975 "bigtableOptions": { # [Optional] Additional options if sourceFormat is set to BIGTABLE.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700976 "readRowkeyAsString": True or False, # [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700977 "ignoreUnspecifiedColumnFamilies": True or False, # [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
978 "columnFamilies": [ # [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
979 {
980 "familyId": "A String", # Identifier of the column family.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700981 "type": "A String", # [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700982 "onlyReadLatest": True or False, # [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
983 "columns": [ # [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
984 {
985 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
986 "qualifierEncoded": "A String", # [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
987 "fieldName": "A String", # [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
988 "onlyReadLatest": True or False, # [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
989 "qualifierString": "A String",
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -0700990 "type": "A String", # [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700991 },
992 ],
993 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
994 },
995 ],
996 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700997 "autodetect": True or False, # Try to detect schema and format options automatically. Any option specified explicitly will be honored.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -0700998 "googleSheetsOptions": { # [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
999 "skipLeadingRows": "A String", # [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001000 "range": "A String", # [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001001 },
1002 "schema": { # [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001003 "fields": [ # Describes the fields in a table.
1004 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001005 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001006 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1007 # Object with schema name: TableFieldSchema
1008 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001009 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001010 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1011 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1012 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1013 "A String",
1014 ],
1015 },
1016 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001017 },
1018 ],
1019 },
1020 },
1021 },
John Asmuth614db982014-04-24 15:46:26 -04001022 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001023 "copy": { # [Pick one] Copies a table.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001024 "sourceTables": [ # [Pick one] Source tables to copy.
1025 {
1026 "projectId": "A String", # [Required] The ID of the project containing this table.
1027 "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.
1028 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1029 },
1030 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001031 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1032 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1033 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001034 "destinationTable": { # [Required] The destination table
1035 "projectId": "A String", # [Required] The ID of the project containing this table.
1036 "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.
1037 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1038 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001039 "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.
1040 "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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001041 "sourceTable": { # [Pick one] Source table to copy.
1042 "projectId": "A String", # [Required] The ID of the project containing this table.
1043 "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.
1044 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1045 },
1046 },
1047 "extract": { # [Pick one] Configures an extract job.
1048 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001049 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001050 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
1051 "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.
1052 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
1053 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
1054 "A String",
1055 ],
1056 "sourceTable": { # [Required] A reference to the table being exported.
1057 "projectId": "A String", # [Required] The ID of the project containing this table.
1058 "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.
1059 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1060 },
1061 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001062 "jobType": "A String", # [Output-only] The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
John Asmuth614db982014-04-24 15:46:26 -04001063 },
1064 "id": "A String", # [Output-only] Opaque ID field of the job
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001065 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04001066 }</pre>
1067</div>
1068
1069<div class="method">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001070 <code class="details" id="getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None, location=None)</code>
John Asmuth614db982014-04-24 15:46:26 -04001071 <pre>Retrieves the results of a query job.
1072
1073Args:
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001074 projectId: string, [Required] Project ID of the query job (required)
1075 jobId: string, [Required] Job ID of the query job (required)
Takashi Matsuo06694102015-09-11 13:55:40 -07001076 timeoutMs: integer, How long to wait for the query to complete, in milliseconds, before returning. Default is 10 seconds. If the timeout passes before the job completes, the 'jobComplete' field in the response will be false
John Asmuth614db982014-04-24 15:46:26 -04001077 pageToken: string, Page token, returned by a previous call, to request the next page of results
1078 maxResults: integer, Maximum number of results to read
1079 startIndex: string, Zero-based index of the starting row
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001080 location: string, The geographic location where the job should run. Required except for US and EU. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
John Asmuth614db982014-04-24 15:46:26 -04001081
1082Returns:
1083 An object of the form:
1084
1085 {
1086 "kind": "bigquery#getQueryResultsResponse", # The resource type of the response.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001087 "errors": [ # [Output-only] The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001088 {
Takashi Matsuo06694102015-09-11 13:55:40 -07001089 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1090 "message": "A String", # A human-readable description of the error.
1091 "reason": "A String", # A short error code that summarizes the error.
1092 "location": "A String", # Specifies where the error occurred, if present.
John Asmuth614db982014-04-24 15:46:26 -04001093 },
1094 ],
1095 "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 -08001096 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001097 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Craig Citroe633be12015-03-02 13:40:36 -08001098 "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 -04001099 },
1100 "pageToken": "A String", # A token used for paging results.
1101 "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.
1102 "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 -08001103 "totalBytesProcessed": "A String", # The total number of bytes processed for this query.
John Asmuth614db982014-04-24 15:46:26 -04001104 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
1105 "etag": "A String", # A hash of this response.
Takashi Matsuo06694102015-09-11 13:55:40 -07001106 "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.
1107 {
1108 "f": [ # Represents a single row in the result set, consisting of one or more fields.
1109 {
1110 "v": "",
1111 },
1112 ],
1113 },
1114 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001115 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -04001116 "schema": { # The schema of the results. Present only when the query completes successfully.
1117 "fields": [ # Describes the fields in a table.
1118 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001119 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -04001120 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1121 # Object with schema name: TableFieldSchema
1122 ],
John Asmuth614db982014-04-24 15:46:26 -04001123 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001124 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1125 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1126 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1127 "A String",
1128 ],
1129 },
1130 "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 -04001131 },
1132 ],
1133 },
1134 }</pre>
1135</div>
1136
1137<div class="method">
Sai Cheemalapatic30d2b52017-03-13 12:12:03 -04001138 <code class="details" id="getQueryResults_next">getQueryResults_next(previous_request, previous_response)</code>
1139 <pre>Retrieves the next page of results.
1140
1141Args:
1142 previous_request: The request for the previous page. (required)
1143 previous_response: The response from the request for the previous page. (required)
1144
1145Returns:
1146 A request object that you can call 'execute()' on to request the next
1147 page. Returns None if there are no more items in the collection.
1148 </pre>
1149</div>
1150
1151<div class="method">
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001152 <code class="details" id="insert">insert(projectId, body=None, media_body=None, media_mime_type=None)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001153 <pre>Starts a new asynchronous job. Requires the Can View project role.
John Asmuth614db982014-04-24 15:46:26 -04001154
1155Args:
1156 projectId: string, Project ID of the project that will be billed for the job (required)
1157 body: object, The request body.
1158 The object takes the form of:
1159
1160{
1161 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
1162 "state": "A String", # [Output-only] Running state of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001163 "errors": [ # [Output-only] The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
John Asmuth614db982014-04-24 15:46:26 -04001164 {
1165 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1166 "message": "A String", # A human-readable description of the error.
1167 "reason": "A String", # A short error code that summarizes the error.
1168 "location": "A String", # Specifies where the error occurred, if present.
1169 },
1170 ],
1171 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
1172 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1173 "message": "A String", # A human-readable description of the error.
1174 "reason": "A String", # A short error code that summarizes the error.
1175 "location": "A String", # Specifies where the error occurred, if present.
1176 },
1177 },
1178 "kind": "bigquery#job", # [Output-only] The type of the resource.
1179 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
1180 "load": { # [Output-only] Statistics for a load job.
1181 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001182 "badRecords": "A String", # [Output-only] The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
John Asmuth614db982014-04-24 15:46:26 -04001183 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001184 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
1185 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
John Asmuth614db982014-04-24 15:46:26 -04001186 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001187 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
1188 "numChildJobs": "A String", # [Output-only] Number of child jobs executed.
1189 "parentJobId": "A String", # [Output-only] If this is a child job, the id of the parent.
1190 "completionRatio": 3.14, # [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
1191 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
1192 {
1193 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
1194 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
1195 },
1196 ],
John Asmuth614db982014-04-24 15:46:26 -04001197 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
1198 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001199 "quotaDeferments": [ # [Output-only] Quotas which delayed this job's start time.
1200 "A String",
1201 ],
John Asmuth614db982014-04-24 15:46:26 -04001202 "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.
1203 "query": { # [Output-only] Statistics for a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001204 "totalPartitionsProcessed": "A String", # [Output-only] Total number of partitions processed from all partitioned tables referenced in the job.
1205 "totalBytesProcessedAccuracy": "A String", # [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
1206 "undeclaredQueryParameters": [ # Standard SQL only: list of undeclared query parameters detected during a dry run validation.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001207 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001208 "parameterType": { # [Required] The type of this parameter.
1209 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
1210 {
1211 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
1212 "name": "A String", # [Optional] The name of this field.
1213 "description": "A String", # [Optional] Human-oriented description of the field.
1214 },
1215 ],
1216 "type": "A String", # [Required] The top level type of this field.
1217 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
1218 },
1219 "parameterValue": { # [Required] The value of this parameter.
1220 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
1221 "a_key": # Object with schema name: QueryParameterValue
1222 },
1223 "arrayValues": [ # [Optional] The array values, if this is an array type.
1224 # Object with schema name: QueryParameterValue
1225 ],
1226 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
1227 },
1228 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
1229 },
1230 ],
1231 "modelTrainingCurrentIteration": 42, # [Output-only, Beta] Deprecated; do not use.
1232 "modelTrainingExpectedTotalIteration": "A String", # [Output-only, Beta] Deprecated; do not use.
1233 "estimatedBytesProcessed": "A String", # [Output-only] The original estimate of bytes processed for the job.
1234 "ddlTargetRoutine": { # The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
1235 "projectId": "A String", # [Required] The ID of the project containing this routine.
1236 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
1237 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
1238 },
1239 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
1240 "billingTier": 42, # [Output-only] Billing tier for the job.
1241 "referencedTables": [ # [Output-only] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
1242 {
1243 "projectId": "A String", # [Required] The ID of the project containing this table.
1244 "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.
1245 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1246 },
1247 ],
1248 "schema": { # [Output-only] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
1249 "fields": [ # Describes the fields in a table.
1250 {
1251 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
1252 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1253 # Object with schema name: TableFieldSchema
1254 ],
1255 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1256 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1257 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1258 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1259 "A String",
1260 ],
1261 },
1262 "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.
1263 },
1264 ],
1265 },
1266 "timeline": [ # [Output-only] [Beta] Describes a timeline of job execution.
1267 {
1268 "pendingUnits": "A String", # Total parallel units of work remaining for the active stages.
1269 "activeUnits": "A String", # Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
1270 "elapsedMs": "A String", # Milliseconds elapsed since the start of query execution.
1271 "completedUnits": "A String", # Total parallel units of work completed by this query.
1272 "totalSlotMs": "A String", # Cumulative slot-ms consumed by the query.
1273 },
1274 ],
1275 "statementType": "A String", # The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "CREATE_MODEL": CREATE [OR REPLACE] MODEL ... AS SELECT ... . "CREATE_PROCEDURE": CREATE PROCEDURE query. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_FUNCTION" : DROP FUNCTION query. "DROP_PROCEDURE": DROP PROCEDURE query. "DROP_TABLE": DROP TABLE query. "DROP_VIEW": DROP VIEW query.
1276 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
1277 {
1278 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
1279 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
1280 },
1281 ],
1282 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
1283 "modelTraining": { # [Output-only, Beta] Information about create model query job progress.
1284 "currentIteration": 42, # [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
1285 "expectedTotalIterations": "A String", # [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop.
1286 },
1287 "ddlTargetTable": { # The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries.
1288 "projectId": "A String", # [Required] The ID of the project containing this table.
1289 "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.
1290 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1291 },
1292 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
1293 "queryPlan": [ # [Output-only] Describes execution plan for the query.
1294 {
1295 "computeMsMax": "A String", # Milliseconds the slowest shard spent on CPU-bound tasks.
1296 "inputStages": [ # IDs for stages that are inputs to this stage.
1297 "A String",
1298 ],
1299 "waitMsAvg": "A String", # Milliseconds the average shard spent waiting to be scheduled.
1300 "id": "A String", # Unique ID for stage within plan.
1301 "endMs": "A String", # Stage end time represented as milliseconds since epoch.
1302 "waitMsMax": "A String", # Milliseconds the slowest shard spent waiting to be scheduled.
1303 "readMsMax": "A String", # Milliseconds the slowest shard spent reading input.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001304 "waitRatioMax": 3.14, # Relative amount of time the slowest shard spent waiting to be scheduled.
1305 "readRatioAvg": 3.14, # Relative amount of time the average shard spent reading input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001306 "parallelInputs": "A String", # Number of parallel input segments to be processed.
1307 "recordsRead": "A String", # Number of records read into the stage.
1308 "computeRatioAvg": 3.14, # Relative amount of time the average shard spent on CPU-bound tasks.
1309 "writeMsAvg": "A String", # Milliseconds the average shard spent on writing output.
1310 "writeMsMax": "A String", # Milliseconds the slowest shard spent on writing output.
1311 "status": "A String", # Current status for the stage.
1312 "startMs": "A String", # Stage start time represented as milliseconds since epoch.
1313 "computeMsAvg": "A String", # Milliseconds the average shard spent on CPU-bound tasks.
1314 "shuffleOutputBytesSpilled": "A String", # Total number of bytes written to shuffle and spilled to disk.
1315 "writeRatioMax": 3.14, # Relative amount of time the slowest shard spent on writing output.
1316 "readMsAvg": "A String", # Milliseconds the average shard spent reading input.
1317 "waitRatioAvg": 3.14, # Relative amount of time the average shard spent waiting to be scheduled.
1318 "completedParallelInputs": "A String", # Number of parallel input segments completed.
1319 "computeRatioMax": 3.14, # Relative amount of time the slowest shard spent on CPU-bound tasks.
1320 "name": "A String", # Human-readable name for stage.
1321 "shuffleOutputBytes": "A String", # Total number of bytes written to shuffle.
1322 "recordsWritten": "A String", # Number of records written by the stage.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001323 "readRatioMax": 3.14, # Relative amount of time the slowest shard spent reading input.
1324 "steps": [ # List of operations within the stage in dependency order (approximately chronological).
1325 {
1326 "kind": "A String", # Machine-readable operation type.
1327 "substeps": [ # Human-readable stage descriptions.
1328 "A String",
1329 ],
1330 },
1331 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001332 "writeRatioAvg": 3.14, # Relative amount of time the average shard spent on writing output.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001333 },
1334 ],
Takashi Matsuo06694102015-09-11 13:55:40 -07001335 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001336 "ddlOperationPerformed": "A String", # The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target.
1337 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -04001338 },
1339 "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 -08001340 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001341 "destinationUriFileCounts": [ # [Output-only] 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.
Craig Citroe633be12015-03-02 13:40:36 -08001342 "A String",
1343 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001344 "inputBytes": "A String", # [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes.
Craig Citroe633be12015-03-02 13:40:36 -08001345 },
John Asmuth614db982014-04-24 15:46:26 -04001346 },
1347 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -08001348 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001349 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Craig Citroe633be12015-03-02 13:40:36 -08001350 "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 -04001351 },
1352 "etag": "A String", # [Output-only] A hash of this resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001353 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
John Asmuth614db982014-04-24 15:46:26 -04001354 "configuration": { # [Required] Describes the job configuration.
1355 "load": { # [Pick one] Configures a load job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001356 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1357 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1358 },
1359 "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.
1360 "destinationTableProperties": { # [Beta] [Optional] Properties with which to create the destination table if it is new.
1361 "friendlyName": "A String", # [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail.
1362 "labels": { # [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
1363 "a_key": "A String",
1364 },
1365 "description": "A String", # [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
1366 },
1367 "autodetect": True or False, # [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
1368 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
1369 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
1370 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
1371 "requirePartitionFilter": True or False,
1372 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
1373 },
1374 "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.
1375 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
1376 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
1377 "A String",
1378 ],
1379 },
1380 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. 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 (',').
1381 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
1382 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
1383 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
1384 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
1385 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
1386 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
1387 },
1388 },
1389 "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. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid.
1390 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001391 "A String",
1392 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001393 "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
1394 "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.
1395 "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.
1396 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
1397 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
1398 "fields": [ # Describes the fields in a table.
1399 {
1400 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
1401 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1402 # Object with schema name: TableFieldSchema
1403 ],
1404 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1405 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1406 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1407 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1408 "A String",
1409 ],
1410 },
1411 "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.
1412 },
1413 ],
1414 },
1415 "useAvroLogicalTypes": True or False, # [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER).
1416 "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 -04001417 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -08001418 "projectId": "A String", # [Required] The ID of the project containing this table.
1419 "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.
1420 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001421 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001422 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
1423 "A String",
1424 ],
1425 "projectionFields": [ # 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.
1426 "A String",
1427 ],
1428 "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". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
1429 "nullMarker": "A String", # [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001430 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001431 "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.
1432 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
John Asmuth614db982014-04-24 15:46:26 -04001433 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
John Asmuth614db982014-04-24 15:46:26 -04001434 },
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001435 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001436 "labels": { # The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001437 "a_key": "A String",
1438 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001439 "jobTimeoutMs": "A String", # [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001440 "query": { # [Pick one] Configures a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001441 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1442 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1443 },
1444 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
1445 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
1446 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
1447 "requirePartitionFilter": True or False,
1448 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
1449 },
1450 "query": "A String", # [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL.
1451 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
1452 "maximumBytesBilled": "A String", # [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
1453 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
1454 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
1455 "A String",
1456 ],
1457 },
1458 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
1459 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001460 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1461 "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.
1462 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001463 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
1464 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
1465 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
1466 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
1467 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
1468 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
1469 },
John Asmuth614db982014-04-24 15:46:26 -04001470 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001471 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001472 "A String",
1473 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001474 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001475 "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.
1476 "userDefinedFunctionResources": [ # Describes user-defined function resources used in the query.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001477 {
1478 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
1479 "inlineCode": "A String", # [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
1480 },
1481 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001482 "flattenResults": true, # [Optional] If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.
1483 "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.
1484 "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. This property must be set for large results that exceed the maximum response size.
1485 "projectId": "A String", # [Required] The ID of the project containing this table.
1486 "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.
1487 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1488 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001489 "queryParameters": [ # Query parameters for standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001490 {
1491 "parameterType": { # [Required] The type of this parameter.
1492 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
1493 {
1494 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001495 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001496 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001497 },
1498 ],
1499 "type": "A String", # [Required] The top level type of this field.
1500 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
1501 },
1502 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -07001503 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
1504 "a_key": # Object with schema name: QueryParameterValue
1505 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001506 "arrayValues": [ # [Optional] The array values, if this is an array type.
1507 # Object with schema name: QueryParameterValue
1508 ],
1509 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
1510 },
1511 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
1512 },
1513 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001514 "maximumBillingTier": 1, # [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.
1515 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
1516 "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 and uses the schema from the query result. 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.
1517 "allowLargeResults": false, # [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001518 "tableDefinitions": { # [Optional] 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.
1519 "a_key": {
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001520 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001521 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
1522 "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 (',').
1523 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001524 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001525 "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.
1526 "skipLeadingRows": "A String", # [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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001527 "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.
1528 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001529 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
1530 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
1531 "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. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001532 "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 Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001533 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001534 "A String",
1535 ],
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001536 "bigtableOptions": { # [Optional] Additional options if sourceFormat is set to BIGTABLE.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07001537 "readRowkeyAsString": True or False, # [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001538 "ignoreUnspecifiedColumnFamilies": True or False, # [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
1539 "columnFamilies": [ # [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
1540 {
1541 "familyId": "A String", # Identifier of the column family.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07001542 "type": "A String", # [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001543 "onlyReadLatest": True or False, # [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
1544 "columns": [ # [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
1545 {
1546 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
1547 "qualifierEncoded": "A String", # [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
1548 "fieldName": "A String", # [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
1549 "onlyReadLatest": True or False, # [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
1550 "qualifierString": "A String",
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07001551 "type": "A String", # [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001552 },
1553 ],
1554 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
1555 },
1556 ],
1557 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001558 "autodetect": True or False, # Try to detect schema and format options automatically. Any option specified explicitly will be honored.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001559 "googleSheetsOptions": { # [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
1560 "skipLeadingRows": "A String", # [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001561 "range": "A String", # [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001562 },
1563 "schema": { # [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001564 "fields": [ # Describes the fields in a table.
1565 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001566 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001567 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1568 # Object with schema name: TableFieldSchema
1569 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001570 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001571 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1572 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1573 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1574 "A String",
1575 ],
1576 },
1577 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001578 },
1579 ],
1580 },
1581 },
1582 },
John Asmuth614db982014-04-24 15:46:26 -04001583 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001584 "copy": { # [Pick one] Copies a table.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001585 "sourceTables": [ # [Pick one] Source tables to copy.
1586 {
1587 "projectId": "A String", # [Required] The ID of the project containing this table.
1588 "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.
1589 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1590 },
1591 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001592 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1593 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1594 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001595 "destinationTable": { # [Required] The destination table
1596 "projectId": "A String", # [Required] The ID of the project containing this table.
1597 "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.
1598 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1599 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001600 "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.
1601 "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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001602 "sourceTable": { # [Pick one] Source table to copy.
1603 "projectId": "A String", # [Required] The ID of the project containing this table.
1604 "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.
1605 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1606 },
1607 },
1608 "extract": { # [Pick one] Configures an extract job.
1609 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001610 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001611 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
1612 "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.
1613 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
1614 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
1615 "A String",
1616 ],
1617 "sourceTable": { # [Required] A reference to the table being exported.
1618 "projectId": "A String", # [Required] The ID of the project containing this table.
1619 "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.
1620 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1621 },
1622 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001623 "jobType": "A String", # [Output-only] The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
John Asmuth614db982014-04-24 15:46:26 -04001624 },
1625 "id": "A String", # [Output-only] Opaque ID field of the job
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001626 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04001627 }
1628
1629 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001630 media_mime_type: string, The MIME type of the media request body, or an instance of a MediaUpload object.
John Asmuth614db982014-04-24 15:46:26 -04001631
1632Returns:
1633 An object of the form:
1634
1635 {
1636 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
1637 "state": "A String", # [Output-only] Running state of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001638 "errors": [ # [Output-only] The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
John Asmuth614db982014-04-24 15:46:26 -04001639 {
1640 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1641 "message": "A String", # A human-readable description of the error.
1642 "reason": "A String", # A short error code that summarizes the error.
1643 "location": "A String", # Specifies where the error occurred, if present.
1644 },
1645 ],
1646 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
1647 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1648 "message": "A String", # A human-readable description of the error.
1649 "reason": "A String", # A short error code that summarizes the error.
1650 "location": "A String", # Specifies where the error occurred, if present.
1651 },
1652 },
1653 "kind": "bigquery#job", # [Output-only] The type of the resource.
1654 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
1655 "load": { # [Output-only] Statistics for a load job.
1656 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001657 "badRecords": "A String", # [Output-only] The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
John Asmuth614db982014-04-24 15:46:26 -04001658 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001659 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
1660 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
John Asmuth614db982014-04-24 15:46:26 -04001661 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001662 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
1663 "numChildJobs": "A String", # [Output-only] Number of child jobs executed.
1664 "parentJobId": "A String", # [Output-only] If this is a child job, the id of the parent.
1665 "completionRatio": 3.14, # [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
1666 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
1667 {
1668 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
1669 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
1670 },
1671 ],
John Asmuth614db982014-04-24 15:46:26 -04001672 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
1673 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001674 "quotaDeferments": [ # [Output-only] Quotas which delayed this job's start time.
1675 "A String",
1676 ],
John Asmuth614db982014-04-24 15:46:26 -04001677 "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.
1678 "query": { # [Output-only] Statistics for a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001679 "totalPartitionsProcessed": "A String", # [Output-only] Total number of partitions processed from all partitioned tables referenced in the job.
1680 "totalBytesProcessedAccuracy": "A String", # [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
1681 "undeclaredQueryParameters": [ # Standard SQL only: list of undeclared query parameters detected during a dry run validation.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001682 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001683 "parameterType": { # [Required] The type of this parameter.
1684 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
1685 {
1686 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
1687 "name": "A String", # [Optional] The name of this field.
1688 "description": "A String", # [Optional] Human-oriented description of the field.
1689 },
1690 ],
1691 "type": "A String", # [Required] The top level type of this field.
1692 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
1693 },
1694 "parameterValue": { # [Required] The value of this parameter.
1695 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
1696 "a_key": # Object with schema name: QueryParameterValue
1697 },
1698 "arrayValues": [ # [Optional] The array values, if this is an array type.
1699 # Object with schema name: QueryParameterValue
1700 ],
1701 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
1702 },
1703 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
1704 },
1705 ],
1706 "modelTrainingCurrentIteration": 42, # [Output-only, Beta] Deprecated; do not use.
1707 "modelTrainingExpectedTotalIteration": "A String", # [Output-only, Beta] Deprecated; do not use.
1708 "estimatedBytesProcessed": "A String", # [Output-only] The original estimate of bytes processed for the job.
1709 "ddlTargetRoutine": { # The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
1710 "projectId": "A String", # [Required] The ID of the project containing this routine.
1711 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
1712 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
1713 },
1714 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
1715 "billingTier": 42, # [Output-only] Billing tier for the job.
1716 "referencedTables": [ # [Output-only] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
1717 {
1718 "projectId": "A String", # [Required] The ID of the project containing this table.
1719 "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.
1720 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1721 },
1722 ],
1723 "schema": { # [Output-only] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
1724 "fields": [ # Describes the fields in a table.
1725 {
1726 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
1727 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1728 # Object with schema name: TableFieldSchema
1729 ],
1730 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1731 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1732 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1733 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1734 "A String",
1735 ],
1736 },
1737 "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.
1738 },
1739 ],
1740 },
1741 "timeline": [ # [Output-only] [Beta] Describes a timeline of job execution.
1742 {
1743 "pendingUnits": "A String", # Total parallel units of work remaining for the active stages.
1744 "activeUnits": "A String", # Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
1745 "elapsedMs": "A String", # Milliseconds elapsed since the start of query execution.
1746 "completedUnits": "A String", # Total parallel units of work completed by this query.
1747 "totalSlotMs": "A String", # Cumulative slot-ms consumed by the query.
1748 },
1749 ],
1750 "statementType": "A String", # The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "CREATE_MODEL": CREATE [OR REPLACE] MODEL ... AS SELECT ... . "CREATE_PROCEDURE": CREATE PROCEDURE query. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_FUNCTION" : DROP FUNCTION query. "DROP_PROCEDURE": DROP PROCEDURE query. "DROP_TABLE": DROP TABLE query. "DROP_VIEW": DROP VIEW query.
1751 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
1752 {
1753 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
1754 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
1755 },
1756 ],
1757 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
1758 "modelTraining": { # [Output-only, Beta] Information about create model query job progress.
1759 "currentIteration": 42, # [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
1760 "expectedTotalIterations": "A String", # [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop.
1761 },
1762 "ddlTargetTable": { # The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries.
1763 "projectId": "A String", # [Required] The ID of the project containing this table.
1764 "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.
1765 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1766 },
1767 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
1768 "queryPlan": [ # [Output-only] Describes execution plan for the query.
1769 {
1770 "computeMsMax": "A String", # Milliseconds the slowest shard spent on CPU-bound tasks.
1771 "inputStages": [ # IDs for stages that are inputs to this stage.
1772 "A String",
1773 ],
1774 "waitMsAvg": "A String", # Milliseconds the average shard spent waiting to be scheduled.
1775 "id": "A String", # Unique ID for stage within plan.
1776 "endMs": "A String", # Stage end time represented as milliseconds since epoch.
1777 "waitMsMax": "A String", # Milliseconds the slowest shard spent waiting to be scheduled.
1778 "readMsMax": "A String", # Milliseconds the slowest shard spent reading input.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001779 "waitRatioMax": 3.14, # Relative amount of time the slowest shard spent waiting to be scheduled.
1780 "readRatioAvg": 3.14, # Relative amount of time the average shard spent reading input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001781 "parallelInputs": "A String", # Number of parallel input segments to be processed.
1782 "recordsRead": "A String", # Number of records read into the stage.
1783 "computeRatioAvg": 3.14, # Relative amount of time the average shard spent on CPU-bound tasks.
1784 "writeMsAvg": "A String", # Milliseconds the average shard spent on writing output.
1785 "writeMsMax": "A String", # Milliseconds the slowest shard spent on writing output.
1786 "status": "A String", # Current status for the stage.
1787 "startMs": "A String", # Stage start time represented as milliseconds since epoch.
1788 "computeMsAvg": "A String", # Milliseconds the average shard spent on CPU-bound tasks.
1789 "shuffleOutputBytesSpilled": "A String", # Total number of bytes written to shuffle and spilled to disk.
1790 "writeRatioMax": 3.14, # Relative amount of time the slowest shard spent on writing output.
1791 "readMsAvg": "A String", # Milliseconds the average shard spent reading input.
1792 "waitRatioAvg": 3.14, # Relative amount of time the average shard spent waiting to be scheduled.
1793 "completedParallelInputs": "A String", # Number of parallel input segments completed.
1794 "computeRatioMax": 3.14, # Relative amount of time the slowest shard spent on CPU-bound tasks.
1795 "name": "A String", # Human-readable name for stage.
1796 "shuffleOutputBytes": "A String", # Total number of bytes written to shuffle.
1797 "recordsWritten": "A String", # Number of records written by the stage.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001798 "readRatioMax": 3.14, # Relative amount of time the slowest shard spent reading input.
1799 "steps": [ # List of operations within the stage in dependency order (approximately chronological).
1800 {
1801 "kind": "A String", # Machine-readable operation type.
1802 "substeps": [ # Human-readable stage descriptions.
1803 "A String",
1804 ],
1805 },
1806 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001807 "writeRatioAvg": 3.14, # Relative amount of time the average shard spent on writing output.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001808 },
1809 ],
Takashi Matsuo06694102015-09-11 13:55:40 -07001810 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001811 "ddlOperationPerformed": "A String", # The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target.
1812 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -04001813 },
1814 "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 -08001815 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001816 "destinationUriFileCounts": [ # [Output-only] 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.
Craig Citroe633be12015-03-02 13:40:36 -08001817 "A String",
1818 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001819 "inputBytes": "A String", # [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes.
Craig Citroe633be12015-03-02 13:40:36 -08001820 },
John Asmuth614db982014-04-24 15:46:26 -04001821 },
1822 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -08001823 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001824 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Craig Citroe633be12015-03-02 13:40:36 -08001825 "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 -04001826 },
1827 "etag": "A String", # [Output-only] A hash of this resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001828 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
John Asmuth614db982014-04-24 15:46:26 -04001829 "configuration": { # [Required] Describes the job configuration.
1830 "load": { # [Pick one] Configures a load job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001831 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1832 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1833 },
1834 "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.
1835 "destinationTableProperties": { # [Beta] [Optional] Properties with which to create the destination table if it is new.
1836 "friendlyName": "A String", # [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail.
1837 "labels": { # [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
1838 "a_key": "A String",
1839 },
1840 "description": "A String", # [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
1841 },
1842 "autodetect": True or False, # [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
1843 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
1844 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
1845 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
1846 "requirePartitionFilter": True or False,
1847 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
1848 },
1849 "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.
1850 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
1851 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
1852 "A String",
1853 ],
1854 },
1855 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. 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 (',').
1856 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
1857 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
1858 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
1859 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
1860 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
1861 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
1862 },
1863 },
1864 "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. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid.
1865 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08001866 "A String",
1867 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001868 "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
1869 "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.
1870 "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.
1871 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
1872 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
1873 "fields": [ # Describes the fields in a table.
1874 {
1875 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
1876 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1877 # Object with schema name: TableFieldSchema
1878 ],
1879 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1880 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
1881 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
1882 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
1883 "A String",
1884 ],
1885 },
1886 "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.
1887 },
1888 ],
1889 },
1890 "useAvroLogicalTypes": True or False, # [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER).
1891 "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 -04001892 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -08001893 "projectId": "A String", # [Required] The ID of the project containing this table.
1894 "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.
1895 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001896 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001897 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
1898 "A String",
1899 ],
1900 "projectionFields": [ # 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.
1901 "A String",
1902 ],
1903 "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". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
1904 "nullMarker": "A String", # [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001905 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001906 "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.
1907 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
John Asmuth614db982014-04-24 15:46:26 -04001908 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
John Asmuth614db982014-04-24 15:46:26 -04001909 },
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001910 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001911 "labels": { # The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001912 "a_key": "A String",
1913 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001914 "jobTimeoutMs": "A String", # [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001915 "query": { # [Pick one] Configures a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001916 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
1917 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
1918 },
1919 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
1920 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
1921 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
1922 "requirePartitionFilter": True or False,
1923 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
1924 },
1925 "query": "A String", # [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL.
1926 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
1927 "maximumBytesBilled": "A String", # [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
1928 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
1929 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
1930 "A String",
1931 ],
1932 },
1933 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
1934 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001935 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1936 "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.
1937 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001938 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
1939 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
1940 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
1941 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
1942 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
1943 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
1944 },
John Asmuth614db982014-04-24 15:46:26 -04001945 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001946 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001947 "A String",
1948 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001949 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001950 "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.
1951 "userDefinedFunctionResources": [ # Describes user-defined function resources used in the query.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001952 {
1953 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
1954 "inlineCode": "A String", # [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
1955 },
1956 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001957 "flattenResults": true, # [Optional] If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.
1958 "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.
1959 "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. This property must be set for large results that exceed the maximum response size.
1960 "projectId": "A String", # [Required] The ID of the project containing this table.
1961 "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.
1962 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
1963 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07001964 "queryParameters": [ # Query parameters for standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001965 {
1966 "parameterType": { # [Required] The type of this parameter.
1967 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
1968 {
1969 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001970 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001971 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001972 },
1973 ],
1974 "type": "A String", # [Required] The top level type of this field.
1975 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
1976 },
1977 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -07001978 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
1979 "a_key": # Object with schema name: QueryParameterValue
1980 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07001981 "arrayValues": [ # [Optional] The array values, if this is an array type.
1982 # Object with schema name: QueryParameterValue
1983 ],
1984 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
1985 },
1986 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
1987 },
1988 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001989 "maximumBillingTier": 1, # [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.
1990 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
1991 "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 and uses the schema from the query result. 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.
1992 "allowLargeResults": false, # [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001993 "tableDefinitions": { # [Optional] 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.
1994 "a_key": {
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07001995 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001996 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
1997 "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 (',').
1998 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001999 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002000 "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.
2001 "skipLeadingRows": "A String", # [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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002002 "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.
2003 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002004 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
2005 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
2006 "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. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002007 "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 Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002008 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002009 "A String",
2010 ],
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002011 "bigtableOptions": { # [Optional] Additional options if sourceFormat is set to BIGTABLE.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002012 "readRowkeyAsString": True or False, # [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002013 "ignoreUnspecifiedColumnFamilies": True or False, # [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
2014 "columnFamilies": [ # [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
2015 {
2016 "familyId": "A String", # Identifier of the column family.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002017 "type": "A String", # [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002018 "onlyReadLatest": True or False, # [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
2019 "columns": [ # [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
2020 {
2021 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
2022 "qualifierEncoded": "A String", # [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
2023 "fieldName": "A String", # [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
2024 "onlyReadLatest": True or False, # [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
2025 "qualifierString": "A String",
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002026 "type": "A String", # [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002027 },
2028 ],
2029 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
2030 },
2031 ],
2032 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002033 "autodetect": True or False, # Try to detect schema and format options automatically. Any option specified explicitly will be honored.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002034 "googleSheetsOptions": { # [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
2035 "skipLeadingRows": "A String", # [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002036 "range": "A String", # [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002037 },
2038 "schema": { # [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002039 "fields": [ # Describes the fields in a table.
2040 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002041 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002042 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
2043 # Object with schema name: TableFieldSchema
2044 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002045 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002046 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
2047 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
2048 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
2049 "A String",
2050 ],
2051 },
2052 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002053 },
2054 ],
2055 },
2056 },
2057 },
John Asmuth614db982014-04-24 15:46:26 -04002058 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002059 "copy": { # [Pick one] Copies a table.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002060 "sourceTables": [ # [Pick one] Source tables to copy.
2061 {
2062 "projectId": "A String", # [Required] The ID of the project containing this table.
2063 "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.
2064 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2065 },
2066 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002067 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
2068 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
2069 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002070 "destinationTable": { # [Required] The destination table
2071 "projectId": "A String", # [Required] The ID of the project containing this table.
2072 "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.
2073 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2074 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002075 "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.
2076 "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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002077 "sourceTable": { # [Pick one] Source table to copy.
2078 "projectId": "A String", # [Required] The ID of the project containing this table.
2079 "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.
2080 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2081 },
2082 },
2083 "extract": { # [Pick one] Configures an extract job.
2084 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002085 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002086 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
2087 "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.
2088 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
2089 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
2090 "A String",
2091 ],
2092 "sourceTable": { # [Required] A reference to the table being exported.
2093 "projectId": "A String", # [Required] The ID of the project containing this table.
2094 "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.
2095 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2096 },
2097 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002098 "jobType": "A String", # [Output-only] The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
John Asmuth614db982014-04-24 15:46:26 -04002099 },
2100 "id": "A String", # [Output-only] Opaque ID field of the job
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002101 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04002102 }</pre>
2103</div>
2104
2105<div class="method">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002106 <code class="details" id="list">list(projectId, maxCreationTime=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None, minCreationTime=None, projection=None)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -07002107 <pre>Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. 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 -04002108
2109Args:
2110 projectId: string, Project ID of the jobs to list (required)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002111 maxCreationTime: string, Max value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created before or at this timestamp are returned
John Asmuth614db982014-04-24 15:46:26 -04002112 stateFilter: string, Filter for job state (repeated)
2113 Allowed values
2114 done - Finished jobs
2115 pending - Pending jobs
2116 running - Running jobs
2117 pageToken: string, Page token, returned by a previous call, to request the next page of results
2118 allUsers: boolean, Whether to display jobs owned by all users in the project. Default false
2119 maxResults: integer, Maximum number of results to return
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002120 minCreationTime: string, Min value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created after or at this timestamp are returned
2121 projection: string, Restrict information returned to a set of selected fields
2122 Allowed values
2123 full - Includes all job data
2124 minimal - Does not include the job configuration
John Asmuth614db982014-04-24 15:46:26 -04002125
2126Returns:
2127 An object of the form:
2128
2129 {
2130 "nextPageToken": "A String", # A token to request the next page of results.
John Asmuth614db982014-04-24 15:46:26 -04002131 "kind": "bigquery#jobList", # The resource type of the response.
2132 "etag": "A String", # A hash of this page of results.
2133 "jobs": [ # List of jobs that were requested.
2134 {
2135 "status": { # [Full-projection-only] Describes the state of the job.
2136 "state": "A String", # [Output-only] Running state of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002137 "errors": [ # [Output-only] The first errors encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
John Asmuth614db982014-04-24 15:46:26 -04002138 {
2139 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
2140 "message": "A String", # A human-readable description of the error.
2141 "reason": "A String", # A short error code that summarizes the error.
2142 "location": "A String", # Specifies where the error occurred, if present.
2143 },
2144 ],
2145 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
2146 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
2147 "message": "A String", # A human-readable description of the error.
2148 "reason": "A String", # A short error code that summarizes the error.
2149 "location": "A String", # Specifies where the error occurred, if present.
2150 },
2151 },
2152 "kind": "bigquery#job", # The resource type.
2153 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
2154 "load": { # [Output-only] Statistics for a load job.
2155 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002156 "badRecords": "A String", # [Output-only] The number of bad records encountered. Note that if the job has failed because of more bad records encountered than the maximum allowed in the load job configuration, then this number can be less than the total number of bad records present in the input data.
John Asmuth614db982014-04-24 15:46:26 -04002157 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -07002158 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
2159 "outputBytes": "A String", # [Output-only] Size of the loaded data in bytes. Note that while a load job is in the running state, this value may change.
John Asmuth614db982014-04-24 15:46:26 -04002160 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002161 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
2162 "numChildJobs": "A String", # [Output-only] Number of child jobs executed.
2163 "parentJobId": "A String", # [Output-only] If this is a child job, the id of the parent.
2164 "completionRatio": 3.14, # [TrustedTester] [Output-only] Job progress (0.0 -> 1.0) for LOAD and EXTRACT jobs.
2165 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
2166 {
2167 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
2168 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
2169 },
2170 ],
John Asmuth614db982014-04-24 15:46:26 -04002171 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
2172 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002173 "quotaDeferments": [ # [Output-only] Quotas which delayed this job's start time.
2174 "A String",
2175 ],
John Asmuth614db982014-04-24 15:46:26 -04002176 "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.
2177 "query": { # [Output-only] Statistics for a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002178 "totalPartitionsProcessed": "A String", # [Output-only] Total number of partitions processed from all partitioned tables referenced in the job.
2179 "totalBytesProcessedAccuracy": "A String", # [Output-only] For dry-run jobs, totalBytesProcessed is an estimate and this field specifies the accuracy of the estimate. Possible values can be: UNKNOWN: accuracy of the estimate is unknown. PRECISE: estimate is precise. LOWER_BOUND: estimate is lower bound of what the query would cost. UPPER_BOUND: estimate is upper bound of what the query would cost.
2180 "undeclaredQueryParameters": [ # Standard SQL only: list of undeclared query parameters detected during a dry run validation.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002181 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002182 "parameterType": { # [Required] The type of this parameter.
2183 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
2184 {
2185 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
2186 "name": "A String", # [Optional] The name of this field.
2187 "description": "A String", # [Optional] Human-oriented description of the field.
2188 },
2189 ],
2190 "type": "A String", # [Required] The top level type of this field.
2191 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
2192 },
2193 "parameterValue": { # [Required] The value of this parameter.
2194 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
2195 "a_key": # Object with schema name: QueryParameterValue
2196 },
2197 "arrayValues": [ # [Optional] The array values, if this is an array type.
2198 # Object with schema name: QueryParameterValue
2199 ],
2200 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
2201 },
2202 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
2203 },
2204 ],
2205 "modelTrainingCurrentIteration": 42, # [Output-only, Beta] Deprecated; do not use.
2206 "modelTrainingExpectedTotalIteration": "A String", # [Output-only, Beta] Deprecated; do not use.
2207 "estimatedBytesProcessed": "A String", # [Output-only] The original estimate of bytes processed for the job.
2208 "ddlTargetRoutine": { # The DDL target routine. Present only for CREATE/DROP FUNCTION/PROCEDURE queries.
2209 "projectId": "A String", # [Required] The ID of the project containing this routine.
2210 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
2211 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
2212 },
2213 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
2214 "billingTier": 42, # [Output-only] Billing tier for the job.
2215 "referencedTables": [ # [Output-only] Referenced tables for the job. Queries that reference more than 50 tables will not have a complete list.
2216 {
2217 "projectId": "A String", # [Required] The ID of the project containing this table.
2218 "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.
2219 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2220 },
2221 ],
2222 "schema": { # [Output-only] The schema of the results. Present only for successful dry run of non-legacy SQL queries.
2223 "fields": [ # Describes the fields in a table.
2224 {
2225 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
2226 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
2227 # Object with schema name: TableFieldSchema
2228 ],
2229 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
2230 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
2231 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
2232 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
2233 "A String",
2234 ],
2235 },
2236 "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.
2237 },
2238 ],
2239 },
2240 "timeline": [ # [Output-only] [Beta] Describes a timeline of job execution.
2241 {
2242 "pendingUnits": "A String", # Total parallel units of work remaining for the active stages.
2243 "activeUnits": "A String", # Total number of units currently being processed by workers. This does not correspond directly to slot usage. This is the largest value observed since the last sample.
2244 "elapsedMs": "A String", # Milliseconds elapsed since the start of query execution.
2245 "completedUnits": "A String", # Total parallel units of work completed by this query.
2246 "totalSlotMs": "A String", # Cumulative slot-ms consumed by the query.
2247 },
2248 ],
2249 "statementType": "A String", # The type of query statement, if valid. Possible values (new values might be added in the future): "SELECT": SELECT query. "INSERT": INSERT query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "UPDATE": UPDATE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "DELETE": DELETE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "MERGE": MERGE query; see https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language. "ALTER_TABLE": ALTER TABLE query. "ALTER_VIEW": ALTER VIEW query. "CREATE_FUNCTION": CREATE FUNCTION query. "CREATE_MODEL": CREATE [OR REPLACE] MODEL ... AS SELECT ... . "CREATE_PROCEDURE": CREATE PROCEDURE query. "CREATE_TABLE": CREATE [OR REPLACE] TABLE without AS SELECT. "CREATE_TABLE_AS_SELECT": CREATE [OR REPLACE] TABLE ... AS SELECT ... . "CREATE_VIEW": CREATE [OR REPLACE] VIEW ... AS SELECT ... . "DROP_FUNCTION" : DROP FUNCTION query. "DROP_PROCEDURE": DROP PROCEDURE query. "DROP_TABLE": DROP TABLE query. "DROP_VIEW": DROP VIEW query.
2250 "reservationUsage": [ # [Output-only] Job resource usage breakdown by reservation.
2251 {
2252 "name": "A String", # [Output-only] Reservation name or "unreserved" for on-demand resources usage.
2253 "slotMs": "A String", # [Output-only] Slot-milliseconds the job spent in the given reservation.
2254 },
2255 ],
2256 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
2257 "modelTraining": { # [Output-only, Beta] Information about create model query job progress.
2258 "currentIteration": 42, # [Output-only, Beta] Index of current ML training iteration. Updated during create model query job to show job progress.
2259 "expectedTotalIterations": "A String", # [Output-only, Beta] Expected number of iterations for the create model query job specified as num_iterations in the input query. The actual total number of iterations may be less than this number due to early stop.
2260 },
2261 "ddlTargetTable": { # The DDL target table. Present only for CREATE/DROP TABLE/VIEW queries.
2262 "projectId": "A String", # [Required] The ID of the project containing this table.
2263 "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.
2264 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2265 },
2266 "totalSlotMs": "A String", # [Output-only] Slot-milliseconds for the job.
2267 "queryPlan": [ # [Output-only] Describes execution plan for the query.
2268 {
2269 "computeMsMax": "A String", # Milliseconds the slowest shard spent on CPU-bound tasks.
2270 "inputStages": [ # IDs for stages that are inputs to this stage.
2271 "A String",
2272 ],
2273 "waitMsAvg": "A String", # Milliseconds the average shard spent waiting to be scheduled.
2274 "id": "A String", # Unique ID for stage within plan.
2275 "endMs": "A String", # Stage end time represented as milliseconds since epoch.
2276 "waitMsMax": "A String", # Milliseconds the slowest shard spent waiting to be scheduled.
2277 "readMsMax": "A String", # Milliseconds the slowest shard spent reading input.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002278 "waitRatioMax": 3.14, # Relative amount of time the slowest shard spent waiting to be scheduled.
2279 "readRatioAvg": 3.14, # Relative amount of time the average shard spent reading input.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002280 "parallelInputs": "A String", # Number of parallel input segments to be processed.
2281 "recordsRead": "A String", # Number of records read into the stage.
2282 "computeRatioAvg": 3.14, # Relative amount of time the average shard spent on CPU-bound tasks.
2283 "writeMsAvg": "A String", # Milliseconds the average shard spent on writing output.
2284 "writeMsMax": "A String", # Milliseconds the slowest shard spent on writing output.
2285 "status": "A String", # Current status for the stage.
2286 "startMs": "A String", # Stage start time represented as milliseconds since epoch.
2287 "computeMsAvg": "A String", # Milliseconds the average shard spent on CPU-bound tasks.
2288 "shuffleOutputBytesSpilled": "A String", # Total number of bytes written to shuffle and spilled to disk.
2289 "writeRatioMax": 3.14, # Relative amount of time the slowest shard spent on writing output.
2290 "readMsAvg": "A String", # Milliseconds the average shard spent reading input.
2291 "waitRatioAvg": 3.14, # Relative amount of time the average shard spent waiting to be scheduled.
2292 "completedParallelInputs": "A String", # Number of parallel input segments completed.
2293 "computeRatioMax": 3.14, # Relative amount of time the slowest shard spent on CPU-bound tasks.
2294 "name": "A String", # Human-readable name for stage.
2295 "shuffleOutputBytes": "A String", # Total number of bytes written to shuffle.
2296 "recordsWritten": "A String", # Number of records written by the stage.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002297 "readRatioMax": 3.14, # Relative amount of time the slowest shard spent reading input.
2298 "steps": [ # List of operations within the stage in dependency order (approximately chronological).
2299 {
2300 "kind": "A String", # Machine-readable operation type.
2301 "substeps": [ # Human-readable stage descriptions.
2302 "A String",
2303 ],
2304 },
2305 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002306 "writeRatioAvg": 3.14, # Relative amount of time the average shard spent on writing output.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002307 },
2308 ],
Takashi Matsuo06694102015-09-11 13:55:40 -07002309 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002310 "ddlOperationPerformed": "A String", # The DDL operation performed, possibly dependent on the pre-existence of the DDL target. Possible values (new values might be added in the future): "CREATE": The query created the DDL target. "SKIP": No-op. Example cases: the query is CREATE TABLE IF NOT EXISTS while the table already exists, or the query is DROP TABLE IF EXISTS while the table does not exist. "REPLACE": The query replaced the DDL target. Example case: the query is CREATE OR REPLACE TABLE, and the table already exists. "DROP": The query deleted the DDL target.
2311 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -04002312 },
2313 "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 -08002314 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -07002315 "destinationUriFileCounts": [ # [Output-only] 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.
Craig Citroe633be12015-03-02 13:40:36 -08002316 "A String",
2317 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002318 "inputBytes": "A String", # [Output-only] Number of user bytes extracted into the result. This is the byte count as computed by BigQuery for billing purposes.
Craig Citroe633be12015-03-02 13:40:36 -08002319 },
John Asmuth614db982014-04-24 15:46:26 -04002320 },
2321 "jobReference": { # Job reference uniquely identifying the job.
Craig Citroe633be12015-03-02 13:40:36 -08002322 "projectId": "A String", # [Required] The ID of the project containing this job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002323 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
Craig Citroe633be12015-03-02 13:40:36 -08002324 "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 -04002325 },
2326 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002327 "errorResult": { # A result object that will be present only if the job has failed.
2328 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
2329 "message": "A String", # A human-readable description of the error.
2330 "reason": "A String", # A short error code that summarizes the error.
2331 "location": "A String", # Specifies where the error occurred, if present.
2332 },
John Asmuth614db982014-04-24 15:46:26 -04002333 "configuration": { # [Full-projection-only] Specifies the job configuration.
2334 "load": { # [Pick one] Configures a load job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002335 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
2336 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
2337 },
2338 "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.
2339 "destinationTableProperties": { # [Beta] [Optional] Properties with which to create the destination table if it is new.
2340 "friendlyName": "A String", # [Optional] The friendly name for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current friendly name is provided, the job will fail.
2341 "labels": { # [Optional] The labels associated with this table. You can use these to organize and group your tables. This will only be used if the destination table is newly created. If the table already exists and labels are different than the current labels are provided, the job will fail.
2342 "a_key": "A String",
2343 },
2344 "description": "A String", # [Optional] The description for the destination table. This will only be used if the destination table is newly created. If the table already exists and a value different than the current description is provided, the job will fail.
2345 },
2346 "autodetect": True or False, # [Optional] Indicates if we should automatically infer the options and schema for CSV and JSON sources.
2347 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2348 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
2349 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
2350 "requirePartitionFilter": True or False,
2351 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
2352 },
2353 "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.
2354 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
2355 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
2356 "A String",
2357 ],
2358 },
2359 "fieldDelimiter": "A String", # [Optional] The separator for fields in a CSV file. The separator can be any ISO-8859-1 single-byte character. To use a character in the range 128-255, you must encode the character as UTF8. 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 (',').
2360 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
2361 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
2362 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
2363 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
2364 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
2365 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
2366 },
2367 },
2368 "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. This is only valid for CSV and JSON. The default value is 0, which requires that all records are valid.
2369 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the load job if a schema is autodetected or supplied in the job configuration. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott692617a2017-01-06 09:58:29 -08002370 "A String",
2371 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002372 "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
2373 "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.
2374 "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.
2375 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
2376 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists, or if you're loading data from Google Cloud Datastore.
2377 "fields": [ # Describes the fields in a table.
2378 {
2379 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
2380 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
2381 # Object with schema name: TableFieldSchema
2382 ],
2383 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
2384 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
2385 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
2386 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
2387 "A String",
2388 ],
2389 },
2390 "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.
2391 },
2392 ],
2393 },
2394 "useAvroLogicalTypes": True or False, # [Optional] If sourceFormat is set to "AVRO", indicates whether to enable interpreting logical types into their corresponding types (ie. TIMESTAMP), instead of only using their raw types (ie. INTEGER).
2395 "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 -04002396 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -08002397 "projectId": "A String", # [Required] The ID of the project containing this table.
2398 "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.
2399 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04002400 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002401 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups: Exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
2402 "A String",
2403 ],
2404 "projectionFields": [ # 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.
2405 "A String",
2406 ],
2407 "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". For Avro, specify "AVRO". For parquet, specify "PARQUET". For orc, specify "ORC". The default value is CSV.
2408 "nullMarker": "A String", # [Optional] Specifies a string that represents a null value in a CSV file. For example, if you specify "\N", BigQuery interprets "\N" as a null value when loading a CSV file. The default value is the empty string. If you set this property to a custom value, BigQuery throws an error if an empty string is present for all data types except for STRING and BYTE. For STRING and BYTE columns, BigQuery interprets the empty string as an empty value.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00002409 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002410 "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.
2411 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
John Asmuth614db982014-04-24 15:46:26 -04002412 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
John Asmuth614db982014-04-24 15:46:26 -04002413 },
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002414 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002415 "labels": { # The labels associated with this job. You can use these to organize and group your jobs. Label keys and values can be no longer than 63 characters, can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter and each label in the list must have a different key.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002416 "a_key": "A String",
2417 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002418 "jobTimeoutMs": "A String", # [Optional] Job timeout in milliseconds. If this time limit is exceeded, BigQuery may attempt to terminate the job.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002419 "query": { # [Pick one] Configures a query job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002420 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
2421 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
2422 },
2423 "timePartitioning": { # Time-based partitioning specification for the destination table. Only one of timePartitioning and rangePartitioning should be specified.
2424 "field": "A String", # [Beta] [Optional] If not set, the table is partitioned by pseudo column, referenced via either '_PARTITIONTIME' as TIMESTAMP type, or '_PARTITIONDATE' as DATE type. If field is specified, the table is instead partitioned by this field. The field must be a top-level TIMESTAMP or DATE field. Its mode must be NULLABLE or REQUIRED.
2425 "type": "A String", # [Required] The only type supported is DAY, which will generate one partition per day.
2426 "requirePartitionFilter": True or False,
2427 "expirationMs": "A String", # [Optional] Number of milliseconds for which to keep the storage for partitions in the table. The storage in a partition will have an expiration time of its partition time plus this value.
2428 },
2429 "query": "A String", # [Required] SQL query text to execute. The useLegacySql field can be used to indicate whether the query uses legacy SQL or standard SQL.
2430 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
2431 "maximumBytesBilled": "A String", # [Optional] Limits the bytes billed for this job. Queries that will have bytes billed beyond this limit will fail (without incurring a charge). If unspecified, this will be set to your project default.
2432 "clustering": { # [Beta] Clustering specification for the destination table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.
2433 "fields": [ # [Repeated] One or more fields on which data should be clustered. Only top-level, non-repeated, simple-type fields are supported. When you cluster a table using multiple columns, the order of columns you specify is important. The order of the specified columns determines the sort order of the data.
2434 "A String",
2435 ],
2436 },
2437 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
2438 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query. Note that this does not alter behavior of unqualified dataset names.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002439 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
2440 "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.
2441 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002442 "rangePartitioning": { # [TrustedTester] Range partitioning specification for this table. Only one of timePartitioning and rangePartitioning should be specified.
2443 "field": "A String", # [TrustedTester] [Required] The table is partitioned by this field. The field must be a top-level NULLABLE/REQUIRED field. The only supported type is INTEGER/INT64.
2444 "range": { # [TrustedTester] [Required] Defines the ranges for range partitioning.
2445 "start": "A String", # [TrustedTester] [Required] The start of range partitioning, inclusive.
2446 "interval": "A String", # [TrustedTester] [Required] The width of each interval.
2447 "end": "A String", # [TrustedTester] [Required] The end of range partitioning, exclusive.
2448 },
John Asmuth614db982014-04-24 15:46:26 -04002449 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002450 "schemaUpdateOptions": [ # Allows the schema of the destination table to be updated as a side effect of the query job. Schema update options are supported in two cases: when writeDisposition is WRITE_APPEND; when writeDisposition is WRITE_TRUNCATE and the destination table is a partition of a table, specified by partition decorators. For normal tables, WRITE_TRUNCATE will always overwrite the schema. One or more of the following values are specified: ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original schema to nullable.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002451 "A String",
2452 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002453 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002454 "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.
2455 "userDefinedFunctionResources": [ # Describes user-defined function resources used in the query.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002456 {
2457 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
2458 "inlineCode": "A String", # [Pick one] An inline resource that contains code for a user-defined function (UDF). Providing a inline code resource is equivalent to providing a URI for a file containing the same code.
2459 },
2460 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002461 "flattenResults": true, # [Optional] If true and query uses legacy SQL dialect, flattens all nested and repeated fields in the query results. allowLargeResults must be true if this is set to false. For standard SQL queries, this flag is ignored and results are never flattened.
2462 "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.
2463 "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. This property must be set for large results that exceed the maximum response size.
2464 "projectId": "A String", # [Required] The ID of the project containing this table.
2465 "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.
2466 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2467 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002468 "queryParameters": [ # Query parameters for standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002469 {
2470 "parameterType": { # [Required] The type of this parameter.
2471 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
2472 {
2473 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002474 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002475 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002476 },
2477 ],
2478 "type": "A String", # [Required] The top level type of this field.
2479 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
2480 },
2481 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -07002482 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
2483 "a_key": # Object with schema name: QueryParameterValue
2484 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002485 "arrayValues": [ # [Optional] The array values, if this is an array type.
2486 # Object with schema name: QueryParameterValue
2487 ],
2488 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
2489 },
2490 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
2491 },
2492 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002493 "maximumBillingTier": 1, # [Optional] Limits the billing tier for this job. Queries that have resource usage beyond this tier will fail (without incurring a charge). If unspecified, this will be set to your project default.
2494 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
2495 "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 and uses the schema from the query result. 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.
2496 "allowLargeResults": false, # [Optional] If true and query uses legacy SQL dialect, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set. For standard SQL queries, this flag is ignored and large results are always allowed. However, you must still set destinationTable when result size exceeds the allowed maximum response size.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002497 "tableDefinitions": { # [Optional] 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.
2498 "a_key": {
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002499 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002500 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
2501 "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 (',').
2502 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002503 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002504 "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.
2505 "skipLeadingRows": "A String", # [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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002506 "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.
2507 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002508 "hivePartitioningMode": "A String", # [Optional, Experimental] If hive partitioning is enabled, which mode to use. Two modes are supported: - AUTO: automatically infer partition key name(s) and type(s). - STRINGS: automatic infer partition key name(s). All types are strings. Not all storage formats support hive partitioning -- requesting hive partitioning on an unsupported format will lead to an error.
2509 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For Google sheets, specify "GOOGLE_SHEETS". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". For Avro files, specify "AVRO". For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". [Beta] For Google Cloud Bigtable, specify "BIGTABLE".
2510 "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. This is only valid for CSV, JSON, and Google Sheets. The default value is 0, which requires that all records are valid. This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore backups and Avro formats.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002511 "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 Google Cloud Bigtable: This setting is ignored. Google Cloud Datastore backups: This setting is ignored. Avro: This setting is ignored.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002512 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud. For Google Cloud Storage URIs: Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources. For Google Cloud Bigtable URIs: Exactly one URI can be specified and it has be a fully specified and valid HTTPS URL for a Google Cloud Bigtable table. For Google Cloud Datastore backups, exactly one URI can be specified. Also, the '*' wildcard character is not allowed.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002513 "A String",
2514 ],
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002515 "bigtableOptions": { # [Optional] Additional options if sourceFormat is set to BIGTABLE.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002516 "readRowkeyAsString": True or False, # [Optional] If field is true, then the rowkey column families will be read and converted to string. Otherwise they are read with BYTES type values and users need to manually cast them with CAST if necessary. The default value is false.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002517 "ignoreUnspecifiedColumnFamilies": True or False, # [Optional] If field is true, then the column families that are not specified in columnFamilies list are not exposed in the table schema. Otherwise, they are read with BYTES type values. The default value is false.
2518 "columnFamilies": [ # [Optional] List of column families to expose in the table schema along with their types. This list restricts the column families that can be referenced in queries and specifies their value types. You can use this list to do type conversions - see the 'type' field for more details. If you leave this list empty, all column families are present in the table schema and their values are read as BYTES. During a query only the column families referenced in that query are read from Bigtable.
2519 {
2520 "familyId": "A String", # Identifier of the column family.
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002521 "type": "A String", # [Optional] The type to convert the value in cells of this column family. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. This can be overridden for a specific column by listing that column in 'columns' and specifying a type for it.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002522 "onlyReadLatest": True or False, # [Optional] If this is set only the latest version of value are exposed for all columns in this column family. This can be overridden for a specific column by listing that column in 'columns' and specifying a different setting for that column.
2523 "columns": [ # [Optional] Lists of columns that should be exposed as individual fields as opposed to a list of (column name, value) pairs. All columns whose qualifier matches a qualifier in this list can be accessed as .. Other columns can be accessed as a list through .Column field.
2524 {
2525 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. 'encoding' can also be set at the column family level. However, the setting at this level takes precedence if 'encoding' is set at both levels.
2526 "qualifierEncoded": "A String", # [Required] Qualifier of the column. Columns in the parent column family that has this exact qualifier are exposed as . field. If the qualifier is valid UTF-8 string, it can be specified in the qualifier_string field. Otherwise, a base-64 encoded value must be set to qualifier_encoded. The column field name is the same as the column qualifier. However, if the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name.
2527 "fieldName": "A String", # [Optional] If the qualifier is not a valid BigQuery field identifier i.e. does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as the column field name and is used as field name in queries.
2528 "onlyReadLatest": True or False, # [Optional] If this is set, only the latest version of value in this column are exposed. 'onlyReadLatest' can also be set at the column family level. However, the setting at this level takes precedence if 'onlyReadLatest' is set at both levels.
2529 "qualifierString": "A String",
Jon Wayne Parrott7d5badb2016-08-16 12:44:29 -07002530 "type": "A String", # [Optional] The type to convert the value in cells of this column. The values are expected to be encoded using HBase Bytes.toBytes function when using the BINARY encoding value. Following BigQuery types are allowed (case-sensitive) - BYTES STRING INTEGER FLOAT BOOLEAN Default type is BYTES. 'type' can also be set at the column family level. However, the setting at this level takes precedence if 'type' is set at both levels.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002531 },
2532 ],
2533 "encoding": "A String", # [Optional] The encoding of the values when the type is not STRING. Acceptable encoding values are: TEXT - indicates values are alphanumeric text strings. BINARY - indicates values are encoded using HBase Bytes.toBytes family of functions. This can be overridden for a specific column by listing that column in 'columns' and specifying an encoding for it.
2534 },
2535 ],
2536 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002537 "autodetect": True or False, # Try to detect schema and format options automatically. Any option specified explicitly will be honored.
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002538 "googleSheetsOptions": { # [Optional] Additional options if sourceFormat is set to GOOGLE_SHEETS.
2539 "skipLeadingRows": "A String", # [Optional] The number of rows at the top of a sheet that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows that should be skipped. When autodetect is on, behavior is the following: * skipLeadingRows unspecified - Autodetect tries to detect headers in the first row. If they are not detected, the row is read as data. Otherwise data is read starting from the second row. * skipLeadingRows is 0 - Instructs autodetect that there are no headers and data should be read starting from the first row. * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect headers in row N. If headers are not detected, row N is just skipped. Otherwise row N is used to extract column names for the detected schema.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002540 "range": "A String", # [Beta] [Optional] Range of a sheet to query from. Only used when non-empty. Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id For example: sheet1!A1:B20
Jon Wayne Parrott0a471d32016-05-19 10:54:38 -07002541 },
2542 "schema": { # [Optional] The schema for the data. Schema is required for CSV and JSON formats. Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, and Avro formats.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002543 "fields": [ # Describes the fields in a table.
2544 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002545 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002546 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
2547 # Object with schema name: TableFieldSchema
2548 ],
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002549 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002550 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
2551 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
2552 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
2553 "A String",
2554 ],
2555 },
2556 "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.
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08002557 },
2558 ],
2559 },
2560 },
2561 },
John Asmuth614db982014-04-24 15:46:26 -04002562 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002563 "copy": { # [Pick one] Copies a table.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002564 "sourceTables": [ # [Pick one] Source tables to copy.
2565 {
2566 "projectId": "A String", # [Required] The ID of the project containing this table.
2567 "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.
2568 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2569 },
2570 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002571 "destinationEncryptionConfiguration": { # Custom encryption configuration (e.g., Cloud KMS keys).
2572 "kmsKeyName": "A String", # [Optional] Describes the Cloud KMS encryption key that will be used to protect destination BigQuery table. The BigQuery Service Account associated with your project requires access to this encryption key.
2573 },
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002574 "destinationTable": { # [Required] The destination table
2575 "projectId": "A String", # [Required] The ID of the project containing this table.
2576 "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.
2577 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2578 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002579 "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.
2580 "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.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002581 "sourceTable": { # [Pick one] Source table to copy.
2582 "projectId": "A String", # [Required] The ID of the project containing this table.
2583 "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.
2584 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2585 },
2586 },
2587 "extract": { # [Pick one] Configures an extract job.
2588 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002589 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP, DEFLATE, SNAPPY, and NONE. The default value is NONE. DEFLATE and SNAPPY are only supported for Avro.
Sai Cheemalapatidf613972016-10-21 13:59:49 -07002590 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
2591 "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.
2592 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
2593 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
2594 "A String",
2595 ],
2596 "sourceTable": { # [Required] A reference to the table being exported.
2597 "projectId": "A String", # [Required] The ID of the project containing this table.
2598 "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.
2599 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
2600 },
2601 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002602 "jobType": "A String", # [Output-only] The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or UNKNOWN.
John Asmuth614db982014-04-24 15:46:26 -04002603 },
2604 "id": "A String", # Unique opaque ID of the job.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002605 "user_email": "A String", # [Full-projection-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04002606 },
2607 ],
2608 }</pre>
2609</div>
2610
2611<div class="method">
2612 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
2613 <pre>Retrieves the next page of results.
2614
2615Args:
2616 previous_request: The request for the previous page. (required)
2617 previous_response: The response from the request for the previous page. (required)
2618
2619Returns:
2620 A request object that you can call 'execute()' on to request the next
2621 page. Returns None if there are no more items in the collection.
2622 </pre>
2623</div>
2624
2625<div class="method">
2626 <code class="details" id="query">query(projectId, body)</code>
2627 <pre>Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
2628
2629Args:
2630 projectId: string, Project ID of the project billed for the query (required)
2631 body: object, The request body. (required)
2632 The object takes the form of:
2633
2634{
2635 "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).
2636 "kind": "bigquery#queryRequest", # The resource type of the request.
Takashi Matsuo06694102015-09-11 13:55:40 -07002637 "dryRun": True or False, # [Optional] If set to true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002638 "parameterMode": "A String", # Standard SQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00002639 "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 -04002640 "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 -08002641 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
2642 "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 -04002643 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002644 "useLegacySql": true, # Specifies whether to use BigQuery's legacy SQL dialect for this query. The default value is true. If set to false, the query will use BigQuery's standard SQL: https://cloud.google.com/bigquery/sql-reference/ When useLegacySql is set to false, the value of flattenResults is ignored; query will be run as if flattenResults is false.
John Asmuth614db982014-04-24 15:46:26 -04002645 "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.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002646 "location": "A String", # The geographic location where the job should run. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
2647 "queryParameters": [ # Query parameters for Standard SQL queries.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002648 {
2649 "parameterType": { # [Required] The type of this parameter.
2650 "structTypes": [ # [Optional] The types of the fields of this struct, in order, if this is a struct.
2651 {
2652 "type": # Object with schema name: QueryParameterType # [Required] The type of this field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002653 "name": "A String", # [Optional] The name of this field.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002654 "description": "A String", # [Optional] Human-oriented description of the field.
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002655 },
2656 ],
2657 "type": "A String", # [Required] The top level type of this field.
2658 "arrayType": # Object with schema name: QueryParameterType # [Optional] The type of the array's elements, if this is an array.
2659 },
2660 "parameterValue": { # [Required] The value of this parameter.
Sai Cheemalapatiea3a5e12016-10-12 14:05:53 -07002661 "structValues": { # [Optional] The struct field values, in order of the struct type's declaration.
2662 "a_key": # Object with schema name: QueryParameterValue
2663 },
Jon Wayne Parrott2512a0c2016-08-29 10:21:22 -07002664 "arrayValues": [ # [Optional] The array values, if this is an array type.
2665 # Object with schema name: QueryParameterValue
2666 ],
2667 "value": "A String", # [Optional] The value of this value, if a simple scalar type.
2668 },
2669 "name": "A String", # [Optional] If unset, this is a positional parameter. Otherwise, should be unique within a query.
2670 },
2671 ],
John Asmuth614db982014-04-24 15:46:26 -04002672 "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 -07002673 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
John Asmuth614db982014-04-24 15:46:26 -04002674 }
2675
2676
2677Returns:
2678 An object of the form:
2679
2680 {
2681 "kind": "bigquery#queryResponse", # The resource type.
Takashi Matsuo06694102015-09-11 13:55:40 -07002682 "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.
2683 {
2684 "f": [ # Represents a single row in the result set, consisting of one or more fields.
2685 {
2686 "v": "",
2687 },
2688 ],
2689 },
2690 ],
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002691 "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).
2692 "projectId": "A String", # [Required] The ID of the project containing this job.
2693 "location": "A String", # The geographic location of the job. See details at https://cloud.google.com/bigquery/docs/locations#specifying_your_location.
2694 "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.
2695 },
2696 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
2697 "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.
2698 "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.
2699 "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.
2700 "pageToken": "A String", # A token used for paging results.
2701 "errors": [ # [Output-only] The first errors or warnings encountered during the running of the job. The final message includes the number of errors that caused the process to stop. Errors here do not necessarily mean that the job has completed or was unsuccessful.
2702 {
2703 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
2704 "message": "A String", # A human-readable description of the error.
2705 "reason": "A String", # A short error code that summarizes the error.
2706 "location": "A String", # Specifies where the error occurred, if present.
2707 },
2708 ],
2709 "numDmlAffectedRows": "A String", # [Output-only] The number of rows affected by a DML statement. Present only for DML statements INSERT, UPDATE or DELETE.
John Asmuth614db982014-04-24 15:46:26 -04002710 "schema": { # The schema of the results. Present only when the query completes successfully.
2711 "fields": [ # Describes the fields in a table.
2712 {
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002713 "description": "A String", # [Optional] The field description. The maximum length is 1,024 characters.
John Asmuth614db982014-04-24 15:46:26 -04002714 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
2715 # Object with schema name: TableFieldSchema
2716 ],
John Asmuth614db982014-04-24 15:46:26 -04002717 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07002718 "type": "A String", # [Required] The field data type. Possible values include STRING, BYTES, INTEGER, INT64 (same as INTEGER), FLOAT, FLOAT64 (same as FLOAT), BOOLEAN, BOOL (same as BOOLEAN), TIMESTAMP, DATE, TIME, DATETIME, RECORD (where RECORD indicates that the field contains a nested schema) or STRUCT (same as RECORD).
2719 "categories": { # [Optional] The categories attached to this field, used for field-level access control.
2720 "names": [ # A list of category resource names. For example, "projects/1/taxonomies/2/categories/3". At most 5 categories are allowed.
2721 "A String",
2722 ],
2723 },
2724 "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 -04002725 },
2726 ],
2727 },
2728 }</pre>
2729</div>
2730
2731</body></html>