blob: b4aa84cc8eded568ca9b012119d6d7a1aaab6da7 [file] [log] [blame]
John Asmuth614db982014-04-24 15:46:26 -04001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="bigquery_v2.html">BigQuery API</a> . <a href="bigquery_v2.jobs.html">jobs</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
Nathaniel Manista4f877e52015-06-15 16:44:50 +000078 <code><a href="#cancel">cancel(projectId, jobId)</a></code></p>
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">
John Asmuth614db982014-04-24 15:46:26 -040081 <code><a href="#get">get(projectId, jobId)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000082<p class="firstline">Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.</p>
John Asmuth614db982014-04-24 15:46:26 -040083<p class="toc_element">
84 <code><a href="#getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</a></code></p>
85<p class="firstline">Retrieves the results of a query job.</p>
86<p class="toc_element">
87 <code><a href="#insert">insert(projectId, body=None, media_body=None)</a></code></p>
Nathaniel Manista4f877e52015-06-15 16:44:50 +000088<p class="firstline">Starts a new asynchronous job. Requires the Can View project role.</p>
John Asmuth614db982014-04-24 15:46:26 -040089<p class="toc_element">
90 <code><a href="#list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</a></code></p>
Takashi Matsuo06694102015-09-11 13:55:40 -070091<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 -040092<p class="toc_element">
93 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
94<p class="firstline">Retrieves the next page of results.</p>
95<p class="toc_element">
96 <code><a href="#query">query(projectId, body)</a></code></p>
97<p class="firstline">Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.</p>
98<h3>Method Details</h3>
99<div class="method">
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000100 <code class="details" id="cancel">cancel(projectId, jobId)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -0700101 <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 +0000102
103Args:
104 projectId: string, Project ID of the job to cancel (required)
105 jobId: string, Job ID of the job to cancel (required)
106
107Returns:
108 An object of the form:
109
110 {
111 "job": { # The final state of the job.
112 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
113 "state": "A String", # [Output-only] Running state of the job.
114 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
115 {
116 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
117 "message": "A String", # A human-readable description of the error.
118 "reason": "A String", # A short error code that summarizes the error.
119 "location": "A String", # Specifies where the error occurred, if present.
120 },
121 ],
122 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
123 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
124 "message": "A String", # A human-readable description of the error.
125 "reason": "A String", # A short error code that summarizes the error.
126 "location": "A String", # Specifies where the error occurred, if present.
127 },
128 },
129 "kind": "bigquery#job", # [Output-only] The type of the resource.
130 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
131 "load": { # [Output-only] Statistics for a load job.
132 "outputRows": "A String", # [Output-only] Number of rows imported in a load job. Note that while an import job is in the running state, this value may change.
133 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700134 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
135 "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 +0000136 },
137 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
138 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
139 "startTime": "A String", # [Output-only] Start time of this job, in milliseconds since the epoch. This field will be present when the job transitions from the PENDING state to either RUNNING or DONE.
140 "query": { # [Output-only] Statistics for a query job.
141 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -0700142 "billingTier": 42, # [Output-only] Billing tier for the job.
143 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
144 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000145 },
146 "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.
147 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700148 "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 +0000149 "A String",
150 ],
151 },
152 },
153 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
154 "projectId": "A String", # [Required] The ID of the project containing this job.
155 "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.
156 },
157 "etag": "A String", # [Output-only] A hash of this resource.
158 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
159 "configuration": { # [Required] Describes the job configuration.
160 "load": { # [Pick one] Configures a load job.
161 "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.
162 "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 (',').
163 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
164 "destinationTable": { # [Required] The destination table to load the data into.
165 "projectId": "A String", # [Required] The ID of the project containing this table.
166 "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.
167 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
168 },
169 "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.
170 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
171 "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.
172 "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.
173 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
174 "A String",
175 ],
176 "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.
177 "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.
178 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
179 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
180 "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.
181 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
182 "A String",
183 ],
184 "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
185 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
186 "fields": [ # Describes the fields in a table.
187 {
188 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
189 # Object with schema name: TableFieldSchema
190 ],
191 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
192 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
193 "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.
194 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
195 },
196 ],
197 },
198 },
199 "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.
200 "link": { # [Pick one] Configures a link job.
201 "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.
202 "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.
203 "destinationTable": { # [Required] The destination table of the link job.
204 "projectId": "A String", # [Required] The ID of the project containing this table.
205 "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.
206 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
207 },
208 "sourceUri": [ # [Required] URI of source table to link.
209 "A String",
210 ],
211 },
212 "query": { # [Pick one] Configures a query job.
213 "flattenResults": true, # [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
214 "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.
215 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
216 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
217 "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.
218 },
219 "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.
220 "projectId": "A String", # [Required] The ID of the project containing this table.
221 "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.
222 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
223 },
224 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
225 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
226 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
227 "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.
228 "query": "A String", # [Required] BigQuery SQL query to execute.
229 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
230 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
231 "a_key": {
232 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
233 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
234 "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 (',').
235 "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.
236 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
237 "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.
238 "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.
239 "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.
240 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700241 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000242 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
Takashi Matsuo06694102015-09-11 13:55:40 -0700243 "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
244 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000245 "A String",
246 ],
247 "schema": { # [Required] The schema for the data.
248 "fields": [ # Describes the fields in a table.
249 {
250 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
251 # Object with schema name: TableFieldSchema
252 ],
253 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
254 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
255 "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.
256 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
257 },
258 ],
259 },
260 },
261 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700262 "userDefinedFunctionResources": [ # [Experimental] Describes user-defined function resources used in the query.
263 {
264 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
265 "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.
266 },
267 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000268 },
269 "copy": { # [Pick one] Copies a table.
270 "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.
271 "sourceTables": [ # [Pick one] Source tables to copy.
272 {
273 "projectId": "A String", # [Required] The ID of the project containing this table.
274 "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.
275 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
276 },
277 ],
278 "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.
279 "destinationTable": { # [Required] The destination table
280 "projectId": "A String", # [Required] The ID of the project containing this table.
281 "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.
282 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
283 },
284 "sourceTable": { # [Pick one] Source table to copy.
285 "projectId": "A String", # [Required] The ID of the project containing this table.
286 "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.
287 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
288 },
289 },
290 "extract": { # [Pick one] Configures an extract job.
291 "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.
292 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
293 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
294 "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.
295 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
296 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
297 "A String",
298 ],
299 "sourceTable": { # [Required] A reference to the table being exported.
300 "projectId": "A String", # [Required] The ID of the project containing this table.
301 "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.
302 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
303 },
304 },
305 },
306 "id": "A String", # [Output-only] Opaque ID field of the job
307 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
308 },
309 "kind": "bigquery#jobCancelResponse", # The resource type of the response.
310 }</pre>
311</div>
312
313<div class="method">
John Asmuth614db982014-04-24 15:46:26 -0400314 <code class="details" id="get">get(projectId, jobId)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000315 <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 -0400316
317Args:
318 projectId: string, Project ID of the requested job (required)
319 jobId: string, Job ID of the requested job (required)
320
321Returns:
322 An object of the form:
323
324 {
325 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
326 "state": "A String", # [Output-only] Running state of the job.
327 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
328 {
329 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
330 "message": "A String", # A human-readable description of the error.
331 "reason": "A String", # A short error code that summarizes the error.
332 "location": "A String", # Specifies where the error occurred, if present.
333 },
334 ],
335 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
336 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
337 "message": "A String", # A human-readable description of the error.
338 "reason": "A String", # A short error code that summarizes the error.
339 "location": "A String", # Specifies where the error occurred, if present.
340 },
341 },
342 "kind": "bigquery#job", # [Output-only] The type of the resource.
343 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
344 "load": { # [Output-only] Statistics for a load job.
345 "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.
346 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700347 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
348 "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 -0400349 },
350 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
351 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
352 "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.
353 "query": { # [Output-only] Statistics for a query job.
354 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -0700355 "billingTier": 42, # [Output-only] Billing tier for the job.
356 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
357 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
John Asmuth614db982014-04-24 15:46:26 -0400358 },
359 "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 -0800360 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700361 "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 -0800362 "A String",
363 ],
364 },
John Asmuth614db982014-04-24 15:46:26 -0400365 },
366 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800367 "projectId": "A String", # [Required] The ID of the project containing this job.
368 "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 -0400369 },
370 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800371 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400372 "configuration": { # [Required] Describes the job configuration.
373 "load": { # [Pick one] Configures a load job.
374 "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.
375 "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 (',').
376 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
377 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800378 "projectId": "A String", # [Required] The ID of the project containing this table.
379 "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.
380 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400381 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000382 "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.
383 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
384 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400385 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000386 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400387 "A String",
388 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000389 "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 -0400390 "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.
391 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
392 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
393 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000394 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800395 "A String",
396 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000397 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400398 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
399 "fields": [ # Describes the fields in a table.
400 {
401 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
402 # Object with schema name: TableFieldSchema
403 ],
404 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -0800405 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
406 "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 -0400407 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
408 },
409 ],
410 },
411 },
412 "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.
413 "link": { # [Pick one] Configures a link job.
414 "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.
415 "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.
416 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800417 "projectId": "A String", # [Required] The ID of the project containing this table.
418 "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.
419 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400420 },
421 "sourceUri": [ # [Required] URI of source table to link.
422 "A String",
423 ],
424 },
425 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000426 "flattenResults": true, # [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
427 "useQueryCache": true, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400428 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800429 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
430 "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 -0400431 },
432 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
Craig Citroe633be12015-03-02 13:40:36 -0800433 "projectId": "A String", # [Required] The ID of the project containing this table.
434 "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.
435 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400436 },
437 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
438 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700439 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400440 "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.
441 "query": "A String", # [Required] BigQuery SQL query to execute.
442 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000443 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
444 "a_key": {
445 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
446 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
447 "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 (',').
448 "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.
449 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
450 "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.
451 "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.
452 "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.
453 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700454 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000455 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
Takashi Matsuo06694102015-09-11 13:55:40 -0700456 "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
457 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000458 "A String",
459 ],
460 "schema": { # [Required] The schema for the data.
461 "fields": [ # Describes the fields in a table.
462 {
463 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
464 # Object with schema name: TableFieldSchema
465 ],
466 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
467 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
468 "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.
469 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
470 },
471 ],
472 },
473 },
474 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700475 "userDefinedFunctionResources": [ # [Experimental] Describes user-defined function resources used in the query.
476 {
477 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
478 "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.
479 },
480 ],
John Asmuth614db982014-04-24 15:46:26 -0400481 },
482 "copy": { # [Pick one] Copies a table.
483 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700484 "sourceTables": [ # [Pick one] Source tables to copy.
485 {
Craig Citroe633be12015-03-02 13:40:36 -0800486 "projectId": "A String", # [Required] The ID of the project containing this table.
487 "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.
488 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700489 },
490 ],
John Asmuth614db982014-04-24 15:46:26 -0400491 "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.
492 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800493 "projectId": "A String", # [Required] The ID of the project containing this table.
494 "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.
495 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400496 },
Craig Citro065b5302014-08-14 00:47:23 -0700497 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800498 "projectId": "A String", # [Required] The ID of the project containing this table.
499 "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.
500 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400501 },
502 },
503 "extract": { # [Pick one] Configures an extract job.
504 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700505 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400506 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700507 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000508 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400509 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
510 "A String",
511 ],
512 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800513 "projectId": "A String", # [Required] The ID of the project containing this table.
514 "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.
515 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400516 },
517 },
518 },
519 "id": "A String", # [Output-only] Opaque ID field of the job
520 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
521 }</pre>
522</div>
523
524<div class="method">
525 <code class="details" id="getQueryResults">getQueryResults(projectId, jobId, timeoutMs=None, pageToken=None, maxResults=None, startIndex=None)</code>
526 <pre>Retrieves the results of a query job.
527
528Args:
529 projectId: string, Project ID of the query job (required)
530 jobId: string, Job ID of the query job (required)
Takashi Matsuo06694102015-09-11 13:55:40 -0700531 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 -0400532 pageToken: string, Page token, returned by a previous call, to request the next page of results
533 maxResults: integer, Maximum number of results to read
534 startIndex: string, Zero-based index of the starting row
535
536Returns:
537 An object of the form:
538
539 {
540 "kind": "bigquery#getQueryResultsResponse", # The resource type of the response.
Takashi Matsuo06694102015-09-11 13:55:40 -0700541 "errors": [ # [Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000542 {
Takashi Matsuo06694102015-09-11 13:55:40 -0700543 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
544 "message": "A String", # A human-readable description of the error.
545 "reason": "A String", # A short error code that summarizes the error.
546 "location": "A String", # Specifies where the error occurred, if present.
John Asmuth614db982014-04-24 15:46:26 -0400547 },
548 ],
549 "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 -0800550 "projectId": "A String", # [Required] The ID of the project containing this job.
551 "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 -0400552 },
553 "pageToken": "A String", # A token used for paging results.
554 "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.
555 "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 -0800556 "totalBytesProcessed": "A String", # The total number of bytes processed for this query.
John Asmuth614db982014-04-24 15:46:26 -0400557 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
558 "etag": "A String", # A hash of this response.
Takashi Matsuo06694102015-09-11 13:55:40 -0700559 "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.
560 {
561 "f": [ # Represents a single row in the result set, consisting of one or more fields.
562 {
563 "v": "",
564 },
565 ],
566 },
567 ],
John Asmuth614db982014-04-24 15:46:26 -0400568 "schema": { # The schema of the results. Present only when the query completes successfully.
569 "fields": [ # Describes the fields in a table.
570 {
571 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
572 # Object with schema name: TableFieldSchema
573 ],
574 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -0800575 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
576 "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 -0400577 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
578 },
579 ],
580 },
581 }</pre>
582</div>
583
584<div class="method">
585 <code class="details" id="insert">insert(projectId, body=None, media_body=None)</code>
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000586 <pre>Starts a new asynchronous job. Requires the Can View project role.
John Asmuth614db982014-04-24 15:46:26 -0400587
588Args:
589 projectId: string, Project ID of the project that will be billed for the job (required)
590 body: object, The request body.
591 The object takes the form of:
592
593{
594 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
595 "state": "A String", # [Output-only] Running state of the job.
596 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
597 {
598 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
599 "message": "A String", # A human-readable description of the error.
600 "reason": "A String", # A short error code that summarizes the error.
601 "location": "A String", # Specifies where the error occurred, if present.
602 },
603 ],
604 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
605 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
606 "message": "A String", # A human-readable description of the error.
607 "reason": "A String", # A short error code that summarizes the error.
608 "location": "A String", # Specifies where the error occurred, if present.
609 },
610 },
611 "kind": "bigquery#job", # [Output-only] The type of the resource.
612 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
613 "load": { # [Output-only] Statistics for a load job.
614 "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.
615 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700616 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
617 "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 -0400618 },
619 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
620 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
621 "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.
622 "query": { # [Output-only] Statistics for a query job.
623 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -0700624 "billingTier": 42, # [Output-only] Billing tier for the job.
625 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
626 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
John Asmuth614db982014-04-24 15:46:26 -0400627 },
628 "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 -0800629 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700630 "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 -0800631 "A String",
632 ],
633 },
John Asmuth614db982014-04-24 15:46:26 -0400634 },
635 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800636 "projectId": "A String", # [Required] The ID of the project containing this job.
637 "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 -0400638 },
639 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800640 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400641 "configuration": { # [Required] Describes the job configuration.
642 "load": { # [Pick one] Configures a load job.
643 "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.
644 "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 (',').
645 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
646 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800647 "projectId": "A String", # [Required] The ID of the project containing this table.
648 "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.
649 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400650 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000651 "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.
652 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
653 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400654 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000655 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400656 "A String",
657 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000658 "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 -0400659 "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.
660 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
661 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
662 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000663 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800664 "A String",
665 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000666 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400667 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
668 "fields": [ # Describes the fields in a table.
669 {
670 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
671 # Object with schema name: TableFieldSchema
672 ],
673 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -0800674 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
675 "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 -0400676 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
677 },
678 ],
679 },
680 },
681 "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.
682 "link": { # [Pick one] Configures a link job.
683 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
684 "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.
685 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800686 "projectId": "A String", # [Required] The ID of the project containing this table.
687 "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.
688 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400689 },
690 "sourceUri": [ # [Required] URI of source table to link.
691 "A String",
692 ],
693 },
694 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000695 "flattenResults": true, # [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
696 "useQueryCache": true, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400697 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800698 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
699 "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 -0400700 },
701 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
Craig Citroe633be12015-03-02 13:40:36 -0800702 "projectId": "A String", # [Required] The ID of the project containing this table.
703 "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.
704 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400705 },
706 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
707 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700708 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400709 "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.
710 "query": "A String", # [Required] BigQuery SQL query to execute.
711 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000712 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
713 "a_key": {
714 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
715 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
716 "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 (',').
717 "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.
718 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
719 "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.
720 "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.
721 "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.
722 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700723 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000724 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
Takashi Matsuo06694102015-09-11 13:55:40 -0700725 "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
726 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000727 "A String",
728 ],
729 "schema": { # [Required] The schema for the data.
730 "fields": [ # Describes the fields in a table.
731 {
732 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
733 # Object with schema name: TableFieldSchema
734 ],
735 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
736 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
737 "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.
738 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
739 },
740 ],
741 },
742 },
743 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700744 "userDefinedFunctionResources": [ # [Experimental] Describes user-defined function resources used in the query.
745 {
746 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
747 "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.
748 },
749 ],
John Asmuth614db982014-04-24 15:46:26 -0400750 },
751 "copy": { # [Pick one] Copies a table.
752 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700753 "sourceTables": [ # [Pick one] Source tables to copy.
754 {
Craig Citroe633be12015-03-02 13:40:36 -0800755 "projectId": "A String", # [Required] The ID of the project containing this table.
756 "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.
757 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700758 },
759 ],
John Asmuth614db982014-04-24 15:46:26 -0400760 "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.
761 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800762 "projectId": "A String", # [Required] The ID of the project containing this table.
763 "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.
764 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400765 },
Craig Citro065b5302014-08-14 00:47:23 -0700766 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800767 "projectId": "A String", # [Required] The ID of the project containing this table.
768 "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.
769 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400770 },
771 },
772 "extract": { # [Pick one] Configures an extract job.
773 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700774 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400775 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700776 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000777 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400778 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
779 "A String",
780 ],
781 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800782 "projectId": "A String", # [Required] The ID of the project containing this table.
783 "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.
784 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400785 },
786 },
787 },
788 "id": "A String", # [Output-only] Opaque ID field of the job
789 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
790 }
791
792 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
793
794Returns:
795 An object of the form:
796
797 {
798 "status": { # [Output-only] The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.
799 "state": "A String", # [Output-only] Running state of the job.
800 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
801 {
802 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
803 "message": "A String", # A human-readable description of the error.
804 "reason": "A String", # A short error code that summarizes the error.
805 "location": "A String", # Specifies where the error occurred, if present.
806 },
807 ],
808 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
809 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
810 "message": "A String", # A human-readable description of the error.
811 "reason": "A String", # A short error code that summarizes the error.
812 "location": "A String", # Specifies where the error occurred, if present.
813 },
814 },
815 "kind": "bigquery#job", # [Output-only] The type of the resource.
816 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
817 "load": { # [Output-only] Statistics for a load job.
818 "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.
819 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700820 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
821 "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 -0400822 },
823 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
824 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
825 "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.
826 "query": { # [Output-only] Statistics for a query job.
827 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -0700828 "billingTier": 42, # [Output-only] Billing tier for the job.
829 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
830 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
John Asmuth614db982014-04-24 15:46:26 -0400831 },
832 "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 -0800833 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -0700834 "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 -0800835 "A String",
836 ],
837 },
John Asmuth614db982014-04-24 15:46:26 -0400838 },
839 "jobReference": { # [Optional] Reference describing the unique-per-user name of the job.
Craig Citroe633be12015-03-02 13:40:36 -0800840 "projectId": "A String", # [Required] The ID of the project containing this job.
841 "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 -0400842 },
843 "etag": "A String", # [Output-only] A hash of this resource.
Craig Citroe633be12015-03-02 13:40:36 -0800844 "user_email": "A String", # [Output-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -0400845 "configuration": { # [Required] Describes the job configuration.
846 "load": { # [Pick one] Configures a load job.
847 "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.
848 "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 (',').
849 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
850 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -0800851 "projectId": "A String", # [Required] The ID of the project containing this table.
852 "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.
853 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400854 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000855 "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.
856 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
857 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -0400858 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000859 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -0400860 "A String",
861 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000862 "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 -0400863 "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.
864 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
865 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
866 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000867 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -0800868 "A String",
869 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000870 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -0400871 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
872 "fields": [ # Describes the fields in a table.
873 {
874 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
875 # Object with schema name: TableFieldSchema
876 ],
877 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -0800878 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
879 "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 -0400880 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
881 },
882 ],
883 },
884 },
885 "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.
886 "link": { # [Pick one] Configures a link job.
887 "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.
888 "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.
889 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -0800890 "projectId": "A String", # [Required] The ID of the project containing this table.
891 "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.
892 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400893 },
894 "sourceUri": [ # [Required] URI of source table to link.
895 "A String",
896 ],
897 },
898 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000899 "flattenResults": true, # [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
900 "useQueryCache": true, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -0400901 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -0800902 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
903 "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 -0400904 },
905 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
Craig Citroe633be12015-03-02 13:40:36 -0800906 "projectId": "A String", # [Required] The ID of the project containing this table.
907 "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.
908 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400909 },
910 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
911 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700912 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -0400913 "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.
914 "query": "A String", # [Required] BigQuery SQL query to execute.
915 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000916 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
917 "a_key": {
918 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
919 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
920 "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 (',').
921 "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.
922 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
923 "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.
924 "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.
925 "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.
926 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700927 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000928 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
Takashi Matsuo06694102015-09-11 13:55:40 -0700929 "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
930 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000931 "A String",
932 ],
933 "schema": { # [Required] The schema for the data.
934 "fields": [ # Describes the fields in a table.
935 {
936 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
937 # Object with schema name: TableFieldSchema
938 ],
939 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
940 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
941 "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.
942 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
943 },
944 ],
945 },
946 },
947 },
Takashi Matsuo06694102015-09-11 13:55:40 -0700948 "userDefinedFunctionResources": [ # [Experimental] Describes user-defined function resources used in the query.
949 {
950 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
951 "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.
952 },
953 ],
John Asmuth614db982014-04-24 15:46:26 -0400954 },
955 "copy": { # [Pick one] Copies a table.
956 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -0700957 "sourceTables": [ # [Pick one] Source tables to copy.
958 {
Craig Citroe633be12015-03-02 13:40:36 -0800959 "projectId": "A String", # [Required] The ID of the project containing this table.
960 "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.
961 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -0700962 },
963 ],
John Asmuth614db982014-04-24 15:46:26 -0400964 "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.
965 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -0800966 "projectId": "A String", # [Required] The ID of the project containing this table.
967 "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.
968 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400969 },
Craig Citro065b5302014-08-14 00:47:23 -0700970 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -0800971 "projectId": "A String", # [Required] The ID of the project containing this table.
972 "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.
973 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400974 },
975 },
976 "extract": { # [Pick one] Configures an extract job.
977 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -0700978 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -0400979 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -0700980 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
Nathaniel Manista4f877e52015-06-15 16:44:50 +0000981 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -0400982 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
983 "A String",
984 ],
985 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -0800986 "projectId": "A String", # [Required] The ID of the project containing this table.
987 "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.
988 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -0400989 },
990 },
991 },
992 "id": "A String", # [Output-only] Opaque ID field of the job
993 "selfLink": "A String", # [Output-only] A URL that can be used to access this resource again.
994 }</pre>
995</div>
996
997<div class="method">
998 <code class="details" id="list">list(projectId, projection=None, stateFilter=None, pageToken=None, allUsers=None, maxResults=None)</code>
Takashi Matsuo06694102015-09-11 13:55:40 -0700999 <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 -04001000
1001Args:
1002 projectId: string, Project ID of the jobs to list (required)
1003 projection: string, Restrict information returned to a set of selected fields
1004 Allowed values
1005 full - Includes all job data
1006 minimal - Does not include the job configuration
1007 stateFilter: string, Filter for job state (repeated)
1008 Allowed values
1009 done - Finished jobs
1010 pending - Pending jobs
1011 running - Running jobs
1012 pageToken: string, Page token, returned by a previous call, to request the next page of results
1013 allUsers: boolean, Whether to display jobs owned by all users in the project. Default false
1014 maxResults: integer, Maximum number of results to return
1015
1016Returns:
1017 An object of the form:
1018
1019 {
1020 "nextPageToken": "A String", # A token to request the next page of results.
John Asmuth614db982014-04-24 15:46:26 -04001021 "kind": "bigquery#jobList", # The resource type of the response.
1022 "etag": "A String", # A hash of this page of results.
1023 "jobs": [ # List of jobs that were requested.
1024 {
1025 "status": { # [Full-projection-only] Describes the state of the job.
1026 "state": "A String", # [Output-only] Running state of the job.
1027 "errors": [ # [Output-only] All errors encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
1028 {
1029 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1030 "message": "A String", # A human-readable description of the error.
1031 "reason": "A String", # A short error code that summarizes the error.
1032 "location": "A String", # Specifies where the error occurred, if present.
1033 },
1034 ],
1035 "errorResult": { # [Output-only] Final error result of the job. If present, indicates that the job has completed and was unsuccessful.
1036 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1037 "message": "A String", # A human-readable description of the error.
1038 "reason": "A String", # A short error code that summarizes the error.
1039 "location": "A String", # Specifies where the error occurred, if present.
1040 },
1041 },
1042 "kind": "bigquery#job", # The resource type.
1043 "statistics": { # [Output-only] Information about the job, including starting time and ending time of the job.
1044 "load": { # [Output-only] Statistics for a load job.
1045 "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.
1046 "inputFiles": "A String", # [Output-only] Number of source files in a load job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001047 "inputFileBytes": "A String", # [Output-only] Number of bytes of source data in a load job.
1048 "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 -04001049 },
1050 "creationTime": "A String", # [Output-only] Creation time of this job, in milliseconds since the epoch. This field will be present on all jobs.
1051 "totalBytesProcessed": "A String", # [Output-only] [Deprecated] Use the bytes processed in the query statistics instead.
1052 "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.
1053 "query": { # [Output-only] Statistics for a query job.
1054 "cacheHit": True or False, # [Output-only] Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -07001055 "billingTier": 42, # [Output-only] Billing tier for the job.
1056 "totalBytesBilled": "A String", # [Output-only] Total bytes billed for the job.
1057 "totalBytesProcessed": "A String", # [Output-only] Total bytes processed for the job.
John Asmuth614db982014-04-24 15:46:26 -04001058 },
1059 "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 -08001060 "extract": { # [Output-only] Statistics for an extract job.
Takashi Matsuo06694102015-09-11 13:55:40 -07001061 "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 -08001062 "A String",
1063 ],
1064 },
John Asmuth614db982014-04-24 15:46:26 -04001065 },
1066 "jobReference": { # Job reference uniquely identifying the job.
Craig Citroe633be12015-03-02 13:40:36 -08001067 "projectId": "A String", # [Required] The ID of the project containing this job.
1068 "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 -04001069 },
1070 "state": "A String", # Running state of the job. When the state is DONE, errorResult can be checked to determine whether the job succeeded or failed.
Craig Citroe633be12015-03-02 13:40:36 -08001071 "user_email": "A String", # [Full-projection-only] Email address of the user who ran the job.
John Asmuth614db982014-04-24 15:46:26 -04001072 "configuration": { # [Full-projection-only] Specifies the job configuration.
1073 "load": { # [Pick one] Configures a load job.
1074 "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.
1075 "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 (',').
1076 "sourceFormat": "A String", # [Optional] The format of the data files. For CSV files, specify "CSV". For datastore backups, specify "DATASTORE_BACKUP". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". The default value is CSV.
1077 "destinationTable": { # [Required] The destination table to load the data into.
Craig Citroe633be12015-03-02 13:40:36 -08001078 "projectId": "A String", # [Required] The ID of the project containing this table.
1079 "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.
1080 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001081 },
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001082 "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.
1083 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when running the job. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
1084 "allowJaggedRows": True or False, # [Optional] Accept rows that are missing trailing optional columns. The missing values are treated as nulls. If false, records with missing trailing columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. Only applicable to CSV, ignored for other formats.
John Asmuth614db982014-04-24 15:46:26 -04001085 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when loading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001086 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
John Asmuth614db982014-04-24 15:46:26 -04001087 "A String",
1088 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001089 "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 -04001090 "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.
1091 "schemaInlineFormat": "A String", # [Deprecated] The format of the schemaInline property.
1092 "schemaInline": "A String", # [Deprecated] The inline schema. For CSV schemas, specify as "Field1:Type1[,Field2:Type2]*". For example, "foo:STRING, bar:INTEGER, baz:FLOAT".
1093 "allowQuotedNewlines": True or False, # Indicates if BigQuery should allow quoted data sections that contain newline characters in a CSV file. The default value is false.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001094 "projectionFields": [ # [Experimental] If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity properties to load into BigQuery from a Cloud Datastore backup. Property names are case sensitive and must be top-level properties. If no properties are specified, BigQuery loads all properties. If any named property isn't found in the Cloud Datastore backup, an invalid error is returned in the job result.
Craig Citroe633be12015-03-02 13:40:36 -08001095 "A String",
1096 ],
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001097 "ignoreUnknownValues": True or False, # [Optional] Indicates if BigQuery should allow extra values that are not represented in the table schema. If true, the extra values are ignored. If false, records with extra columns are treated as bad records, and if there are too many bad records, an invalid error is returned in the job result. The default value is false. The sourceFormat property determines what BigQuery treats as an extra value: CSV: Trailing columns JSON: Named values that don't match any column names
John Asmuth614db982014-04-24 15:46:26 -04001098 "schema": { # [Optional] The schema for the destination table. The schema can be omitted if the destination table already exists or if the schema can be inferred from the loaded data.
1099 "fields": [ # Describes the fields in a table.
1100 {
1101 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1102 # Object with schema name: TableFieldSchema
1103 ],
1104 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -08001105 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1106 "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 -04001107 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1108 },
1109 ],
1110 },
1111 },
1112 "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.
1113 "link": { # [Pick one] Configures a link job.
1114 "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.
1115 "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.
1116 "destinationTable": { # [Required] The destination table of the link job.
Craig Citroe633be12015-03-02 13:40:36 -08001117 "projectId": "A String", # [Required] The ID of the project containing this table.
1118 "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.
1119 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001120 },
1121 "sourceUri": [ # [Required] URI of source table to link.
1122 "A String",
1123 ],
1124 },
1125 "query": { # [Pick one] Configures a query job.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001126 "flattenResults": true, # [Optional] Flattens all nested and repeated fields in the query results. The default value is true. allowLargeResults must be true if this is set to false.
1127 "useQueryCache": true, # [Optional] Whether to look for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. Moreover, the query cache is only available when a query does not have a destination table specified. The default value is true.
John Asmuth614db982014-04-24 15:46:26 -04001128 "defaultDataset": { # [Optional] Specifies the default dataset to use for unqualified table names in the query.
Craig Citroe633be12015-03-02 13:40:36 -08001129 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1130 "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 -04001131 },
1132 "destinationTable": { # [Optional] Describes the table where the query results should be stored. If not present, a new table will be created to store the results.
Craig Citroe633be12015-03-02 13:40:36 -08001133 "projectId": "A String", # [Required] The ID of the project containing this table.
1134 "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.
1135 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001136 },
1137 "priority": "A String", # [Optional] Specifies a priority for the query. Possible values include INTERACTIVE and BATCH. The default value is INTERACTIVE.
1138 "writeDisposition": "A String", # [Optional] Specifies the action that occurs if the destination table already exists. The following values are supported: WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data. WRITE_APPEND: If the table already exists, BigQuery appends the data to the table. WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' error is returned in the job result. The default value is WRITE_EMPTY. Each action is atomic and only occurs if BigQuery is able to complete the job successfully. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -07001139 "allowLargeResults": True or False, # If true, allows the query to produce arbitrarily large result tables at a slight cost in performance. Requires destinationTable to be set.
John Asmuth614db982014-04-24 15:46:26 -04001140 "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.
1141 "query": "A String", # [Required] BigQuery SQL query to execute.
1142 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001143 "tableDefinitions": { # [Experimental] If querying an external data source outside of BigQuery, describes the data format, location and other properties of the data source. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.
1144 "a_key": {
1145 "compression": "A String", # [Optional] The compression type of the data source. Possible values include GZIP and NONE. The default value is NONE.
1146 "csvOptions": { # Additional properties to set if sourceFormat is set to CSV.
1147 "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 (',').
1148 "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.
1149 "skipLeadingRows": 42, # [Optional] The number of rows at the top of a CSV file that BigQuery will skip when reading the data. The default value is 0. This property is useful if you have header rows in the file that should be skipped.
1150 "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.
1151 "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.
1152 "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.
1153 },
Takashi Matsuo06694102015-09-11 13:55:40 -07001154 "sourceFormat": "A String", # [Required] The data format. For CSV files, specify "CSV". For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON".
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001155 "maxBadRecords": 42, # [Optional] The maximum number of bad records that BigQuery can ignore when reading data. If the number of bad records exceeds this value, an invalid error is returned in the job result. The default value is 0, which requires that all records are valid.
Takashi Matsuo06694102015-09-11 13:55:40 -07001156 "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
1157 "sourceUris": [ # [Required] The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name. Size limits related to load jobs apply to external data sources, plus an additional limit of 10 GB maximum size across all URIs.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001158 "A String",
1159 ],
1160 "schema": { # [Required] The schema for the data.
1161 "fields": [ # Describes the fields in a table.
1162 {
1163 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1164 # Object with schema name: TableFieldSchema
1165 ],
1166 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
1167 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1168 "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.
1169 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1170 },
1171 ],
1172 },
1173 },
1174 },
Takashi Matsuo06694102015-09-11 13:55:40 -07001175 "userDefinedFunctionResources": [ # [Experimental] Describes user-defined function resources used in the query.
1176 {
1177 "resourceUri": "A String", # [Pick one] A code resource to load from a Google Cloud Storage URI (gs://bucket/path).
1178 "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.
1179 },
1180 ],
John Asmuth614db982014-04-24 15:46:26 -04001181 },
1182 "copy": { # [Pick one] Copies a table.
1183 "createDisposition": "A String", # [Optional] Specifies whether the job is allowed to create new tables. The following values are supported: CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table. CREATE_NEVER: The table must already exist. If it does not, a 'notFound' error is returned in the job result. The default value is CREATE_IF_NEEDED. Creation, truncation and append actions occur as one atomic update upon job completion.
Craig Citro065b5302014-08-14 00:47:23 -07001184 "sourceTables": [ # [Pick one] Source tables to copy.
1185 {
Craig Citroe633be12015-03-02 13:40:36 -08001186 "projectId": "A String", # [Required] The ID of the project containing this table.
1187 "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.
1188 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
Craig Citro065b5302014-08-14 00:47:23 -07001189 },
1190 ],
John Asmuth614db982014-04-24 15:46:26 -04001191 "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.
1192 "destinationTable": { # [Required] The destination table
Craig Citroe633be12015-03-02 13:40:36 -08001193 "projectId": "A String", # [Required] The ID of the project containing this table.
1194 "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.
1195 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001196 },
Craig Citro065b5302014-08-14 00:47:23 -07001197 "sourceTable": { # [Pick one] Source table to copy.
Craig Citroe633be12015-03-02 13:40:36 -08001198 "projectId": "A String", # [Required] The ID of the project containing this table.
1199 "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.
1200 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001201 },
1202 },
1203 "extract": { # [Pick one] Configures an extract job.
1204 "destinationUri": "A String", # [Pick one] DEPRECATED: Use destinationUris instead, passing only one URI as necessary. The fully-qualified Google Cloud Storage URI where the extracted table should be written.
Craig Citro065b5302014-08-14 00:47:23 -07001205 "compression": "A String", # [Optional] The compression type to use for exported files. Possible values include GZIP and NONE. The default value is NONE.
John Asmuth614db982014-04-24 15:46:26 -04001206 "fieldDelimiter": "A String", # [Optional] Delimiter to use between fields in the exported data. Default is ','
Craig Citro065b5302014-08-14 00:47:23 -07001207 "destinationFormat": "A String", # [Optional] The exported file format. Possible values include CSV, NEWLINE_DELIMITED_JSON and AVRO. The default value is CSV. Tables with nested or repeated fields cannot be exported as CSV.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001208 "printHeader": true, # [Optional] Whether to print out a header row in the results. Default is true.
John Asmuth614db982014-04-24 15:46:26 -04001209 "destinationUris": [ # [Pick one] A list of fully-qualified Google Cloud Storage URIs where the extracted table should be written.
1210 "A String",
1211 ],
1212 "sourceTable": { # [Required] A reference to the table being exported.
Craig Citroe633be12015-03-02 13:40:36 -08001213 "projectId": "A String", # [Required] The ID of the project containing this table.
1214 "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.
1215 "datasetId": "A String", # [Required] The ID of the dataset containing this table.
John Asmuth614db982014-04-24 15:46:26 -04001216 },
1217 },
1218 },
1219 "id": "A String", # Unique opaque ID of the job.
1220 "errorResult": { # A result object that will be present only if the job has failed.
1221 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1222 "message": "A String", # A human-readable description of the error.
1223 "reason": "A String", # A short error code that summarizes the error.
1224 "location": "A String", # Specifies where the error occurred, if present.
1225 },
1226 },
1227 ],
1228 }</pre>
1229</div>
1230
1231<div class="method">
1232 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
1233 <pre>Retrieves the next page of results.
1234
1235Args:
1236 previous_request: The request for the previous page. (required)
1237 previous_response: The response from the request for the previous page. (required)
1238
1239Returns:
1240 A request object that you can call 'execute()' on to request the next
1241 page. Returns None if there are no more items in the collection.
1242 </pre>
1243</div>
1244
1245<div class="method">
1246 <code class="details" id="query">query(projectId, body)</code>
1247 <pre>Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.
1248
1249Args:
1250 projectId: string, Project ID of the project billed for the query (required)
1251 body: object, The request body. (required)
1252 The object takes the form of:
1253
1254{
1255 "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).
1256 "kind": "bigquery#queryRequest", # The resource type of the request.
Takashi Matsuo06694102015-09-11 13:55:40 -07001257 "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.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001258 "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 -04001259 "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 -08001260 "projectId": "A String", # [Optional] The ID of the project containing this dataset.
1261 "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 -04001262 },
1263 "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.
1264 "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 -07001265 "preserveNulls": True or False, # [Deprecated] This property is deprecated.
John Asmuth614db982014-04-24 15:46:26 -04001266 }
1267
1268
1269Returns:
1270 An object of the form:
1271
1272 {
1273 "kind": "bigquery#queryResponse", # The resource type.
Takashi Matsuo06694102015-09-11 13:55:40 -07001274 "errors": [ # [Output-only] All errors and warnings encountered during the running of the job. Errors here do not necessarily mean that the job has completed or was unsuccessful.
Nathaniel Manista4f877e52015-06-15 16:44:50 +00001275 {
Takashi Matsuo06694102015-09-11 13:55:40 -07001276 "debugInfo": "A String", # Debugging information. This property is internal to Google and should not be used.
1277 "message": "A String", # A human-readable description of the error.
1278 "reason": "A String", # A short error code that summarizes the error.
1279 "location": "A String", # Specifies where the error occurred, if present.
John Asmuth614db982014-04-24 15:46:26 -04001280 },
1281 ],
1282 "jobReference": { # Reference to the Job that was created to run the query. This field will be present even if the original request timed out, in which case GetQueryResults can be used to read the results once the query has completed. Since this API only returns the first page of results, subsequent pages can be fetched via the same mechanism (GetQueryResults).
Craig Citroe633be12015-03-02 13:40:36 -08001283 "projectId": "A String", # [Required] The ID of the project containing this job.
1284 "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 -04001285 },
1286 "pageToken": "A String", # A token used for paging results.
1287 "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.
1288 "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.
1289 "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.
1290 "cacheHit": True or False, # Whether the query result was fetched from the query cache.
Takashi Matsuo06694102015-09-11 13:55:40 -07001291 "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.
1292 {
1293 "f": [ # Represents a single row in the result set, consisting of one or more fields.
1294 {
1295 "v": "",
1296 },
1297 ],
1298 },
1299 ],
John Asmuth614db982014-04-24 15:46:26 -04001300 "schema": { # The schema of the results. Present only when the query completes successfully.
1301 "fields": [ # Describes the fields in a table.
1302 {
1303 "fields": [ # [Optional] Describes the nested schema fields if the type property is set to RECORD.
1304 # Object with schema name: TableFieldSchema
1305 ],
1306 "type": "A String", # [Required] The field data type. Possible values include STRING, INTEGER, FLOAT, BOOLEAN, TIMESTAMP or RECORD (where RECORD indicates that the field contains a nested schema).
Craig Citroe633be12015-03-02 13:40:36 -08001307 "description": "A String", # [Optional] The field description. The maximum length is 16K characters.
1308 "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 -04001309 "mode": "A String", # [Optional] The field mode. Possible values include NULLABLE, REQUIRED and REPEATED. The default value is NULLABLE.
1310 },
1311 ],
1312 },
1313 }</pre>
1314</div>
1315
1316</body></html>