blob: 28260ebd9e84263b09812fe04b75c639f7c45a3f [file] [log] [blame]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001<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.routines.html">routines</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#delete">delete(projectId, datasetId, routineId)</a></code></p>
79<p class="firstline">Deletes the routine specified by routineId from the dataset.</p>
80<p class="toc_element">
81 <code><a href="#get">get(projectId, datasetId, routineId, fieldMask=None)</a></code></p>
82<p class="firstline">Gets the specified routine resource by routine ID.</p>
83<p class="toc_element">
84 <code><a href="#insert">insert(projectId, datasetId, body)</a></code></p>
85<p class="firstline">Creates a new routine in the dataset.</p>
86<p class="toc_element">
87 <code><a href="#list">list(projectId, datasetId, pageToken=None, maxResults=None)</a></code></p>
88<p class="firstline">Lists all routines in the specified dataset. Requires the READER dataset</p>
89<p class="toc_element">
90 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
91<p class="firstline">Retrieves the next page of results.</p>
92<p class="toc_element">
93 <code><a href="#update">update(projectId, datasetId, routineId, body)</a></code></p>
94<p class="firstline">Updates information in an existing routine. The update method replaces the</p>
95<h3>Method Details</h3>
96<div class="method">
97 <code class="details" id="delete">delete(projectId, datasetId, routineId)</code>
98 <pre>Deletes the routine specified by routineId from the dataset.
99
100Args:
101 projectId: string, Project ID of the routine to delete (required)
102 datasetId: string, Dataset ID of the routine to delete (required)
103 routineId: string, Routine ID of the routine to delete (required)
104</pre>
105</div>
106
107<div class="method">
108 <code class="details" id="get">get(projectId, datasetId, routineId, fieldMask=None)</code>
109 <pre>Gets the specified routine resource by routine ID.
110
111Args:
112 projectId: string, Project ID of the requested routine (required)
113 datasetId: string, Dataset ID of the requested routine (required)
114 routineId: string, Routine ID of the requested routine (required)
115 fieldMask: string, If set, only the Routine fields in the field mask are returned in the
116response. If unset, all Routine fields are returned.
117
118Returns:
119 An object of the form:
120
121 { # A user-defined function or a stored procedure.
122 "routineType": "A String", # Required.
123 "language": "A String", # Optional. Defaults to "SQL".
124 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
125 # the epoch.
126 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
127 # imported JAVASCRIPT libraries.
128 "A String",
129 ],
130 "routineReference": { # Required. Reference describing the ID of this routine.
131 "projectId": "A String", # [Required] The ID of the project containing this routine.
132 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
133 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
134 },
135 "etag": "A String", # Output only. A hash of this resource.
136 "arguments": [ # Optional.
137 { # Input/output argument of a function or a stored procedure.
138 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
139 # Examples:
140 # INT64: {type_kind="INT64"}
141 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
142 # STRUCT<x STRING, y ARRAY<DATE>>:
143 # {type_kind="STRUCT",
144 # struct_type={fields=[
145 # {name="x", type={type_kind="STRING"}},
146 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
147 # ]}}
148 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
149 "fields": [
150 # Object with schema name: StandardSqlField
151 ],
152 },
153 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
154 "typeKind": "A String", # Required. The top level type of this field.
155 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
156 },
157 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
158 "mode": "A String", # Optional. Specifies whether the argument is input or output.
159 # Can be set for procedures only.
160 "name": "A String", # Optional. The name of this argument. Can be absent for function return
161 # argument.
162 },
163 ],
164 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
165 # If absent, the return type is inferred from definition_body at query time
166 # in each query that references this routine. If present, then the evaluated
167 # result will be cast to the specified returned type at query time.
168 #
169 # For example, for the functions created with the following statements
170 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
171 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
172 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
173 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
174 # is absent for Increment (inferred as FLOAT64 at query time).
175 # Suppose the function Add is replaced by
176 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
177 # Then the inferred return type of Increment is automatically changed to
178 # INT64 at query time, while the return type of Decrement remains FLOAT64.
179 # Examples:
180 # INT64: {type_kind="INT64"}
181 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
182 # STRUCT<x STRING, y ARRAY<DATE>>:
183 # {type_kind="STRUCT",
184 # struct_type={fields=[
185 # {name="x", type={type_kind="STRING"}},
186 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
187 # ]}}
188 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
189 "fields": [
190 # Object with schema name: StandardSqlField
191 ],
192 },
193 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
194 "typeKind": "A String", # Required. The top level type of this field.
195 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
196 },
197 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
198 # since the epoch.
199 "definitionBody": "A String", # Required. The body of the routine.
200 # For functions, this is the expression in the AS clause.
201 # If language=SQL, it is the substring inside (but excluding) the
202 # parentheses. For example, for the function created with the following
203 # statement
204 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
205 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
206 # linebreak).
207 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
208 # For example, for the function created with the following statement
209 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
210 # definition_body = 'return "\n";\n' (both \n are replaced with
211 # linebreaks).
212 }</pre>
213</div>
214
215<div class="method">
216 <code class="details" id="insert">insert(projectId, datasetId, body)</code>
217 <pre>Creates a new routine in the dataset.
218
219Args:
220 projectId: string, Project ID of the new routine (required)
221 datasetId: string, Dataset ID of the new routine (required)
222 body: object, The request body. (required)
223 The object takes the form of:
224
225{ # A user-defined function or a stored procedure.
226 "routineType": "A String", # Required.
227 "language": "A String", # Optional. Defaults to "SQL".
228 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
229 # the epoch.
230 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
231 # imported JAVASCRIPT libraries.
232 "A String",
233 ],
234 "routineReference": { # Required. Reference describing the ID of this routine.
235 "projectId": "A String", # [Required] The ID of the project containing this routine.
236 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
237 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
238 },
239 "etag": "A String", # Output only. A hash of this resource.
240 "arguments": [ # Optional.
241 { # Input/output argument of a function or a stored procedure.
242 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
243 # Examples:
244 # INT64: {type_kind="INT64"}
245 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
246 # STRUCT<x STRING, y ARRAY<DATE>>:
247 # {type_kind="STRUCT",
248 # struct_type={fields=[
249 # {name="x", type={type_kind="STRING"}},
250 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
251 # ]}}
252 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
253 "fields": [
254 # Object with schema name: StandardSqlField
255 ],
256 },
257 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
258 "typeKind": "A String", # Required. The top level type of this field.
259 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
260 },
261 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
262 "mode": "A String", # Optional. Specifies whether the argument is input or output.
263 # Can be set for procedures only.
264 "name": "A String", # Optional. The name of this argument. Can be absent for function return
265 # argument.
266 },
267 ],
268 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
269 # If absent, the return type is inferred from definition_body at query time
270 # in each query that references this routine. If present, then the evaluated
271 # result will be cast to the specified returned type at query time.
272 #
273 # For example, for the functions created with the following statements
274 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
275 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
276 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
277 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
278 # is absent for Increment (inferred as FLOAT64 at query time).
279 # Suppose the function Add is replaced by
280 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
281 # Then the inferred return type of Increment is automatically changed to
282 # INT64 at query time, while the return type of Decrement remains FLOAT64.
283 # Examples:
284 # INT64: {type_kind="INT64"}
285 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
286 # STRUCT<x STRING, y ARRAY<DATE>>:
287 # {type_kind="STRUCT",
288 # struct_type={fields=[
289 # {name="x", type={type_kind="STRING"}},
290 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
291 # ]}}
292 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
293 "fields": [
294 # Object with schema name: StandardSqlField
295 ],
296 },
297 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
298 "typeKind": "A String", # Required. The top level type of this field.
299 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
300 },
301 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
302 # since the epoch.
303 "definitionBody": "A String", # Required. The body of the routine.
304 # For functions, this is the expression in the AS clause.
305 # If language=SQL, it is the substring inside (but excluding) the
306 # parentheses. For example, for the function created with the following
307 # statement
308 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
309 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
310 # linebreak).
311 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
312 # For example, for the function created with the following statement
313 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
314 # definition_body = 'return "\n";\n' (both \n are replaced with
315 # linebreaks).
316 }
317
318
319Returns:
320 An object of the form:
321
322 { # A user-defined function or a stored procedure.
323 "routineType": "A String", # Required.
324 "language": "A String", # Optional. Defaults to "SQL".
325 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
326 # the epoch.
327 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
328 # imported JAVASCRIPT libraries.
329 "A String",
330 ],
331 "routineReference": { # Required. Reference describing the ID of this routine.
332 "projectId": "A String", # [Required] The ID of the project containing this routine.
333 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
334 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
335 },
336 "etag": "A String", # Output only. A hash of this resource.
337 "arguments": [ # Optional.
338 { # Input/output argument of a function or a stored procedure.
339 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
340 # Examples:
341 # INT64: {type_kind="INT64"}
342 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
343 # STRUCT<x STRING, y ARRAY<DATE>>:
344 # {type_kind="STRUCT",
345 # struct_type={fields=[
346 # {name="x", type={type_kind="STRING"}},
347 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
348 # ]}}
349 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
350 "fields": [
351 # Object with schema name: StandardSqlField
352 ],
353 },
354 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
355 "typeKind": "A String", # Required. The top level type of this field.
356 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
357 },
358 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
359 "mode": "A String", # Optional. Specifies whether the argument is input or output.
360 # Can be set for procedures only.
361 "name": "A String", # Optional. The name of this argument. Can be absent for function return
362 # argument.
363 },
364 ],
365 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
366 # If absent, the return type is inferred from definition_body at query time
367 # in each query that references this routine. If present, then the evaluated
368 # result will be cast to the specified returned type at query time.
369 #
370 # For example, for the functions created with the following statements
371 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
372 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
373 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
374 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
375 # is absent for Increment (inferred as FLOAT64 at query time).
376 # Suppose the function Add is replaced by
377 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
378 # Then the inferred return type of Increment is automatically changed to
379 # INT64 at query time, while the return type of Decrement remains FLOAT64.
380 # Examples:
381 # INT64: {type_kind="INT64"}
382 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
383 # STRUCT<x STRING, y ARRAY<DATE>>:
384 # {type_kind="STRUCT",
385 # struct_type={fields=[
386 # {name="x", type={type_kind="STRING"}},
387 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
388 # ]}}
389 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
390 "fields": [
391 # Object with schema name: StandardSqlField
392 ],
393 },
394 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
395 "typeKind": "A String", # Required. The top level type of this field.
396 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
397 },
398 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
399 # since the epoch.
400 "definitionBody": "A String", # Required. The body of the routine.
401 # For functions, this is the expression in the AS clause.
402 # If language=SQL, it is the substring inside (but excluding) the
403 # parentheses. For example, for the function created with the following
404 # statement
405 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
406 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
407 # linebreak).
408 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
409 # For example, for the function created with the following statement
410 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
411 # definition_body = 'return "\n";\n' (both \n are replaced with
412 # linebreaks).
413 }</pre>
414</div>
415
416<div class="method">
417 <code class="details" id="list">list(projectId, datasetId, pageToken=None, maxResults=None)</code>
418 <pre>Lists all routines in the specified dataset. Requires the READER dataset
419role.
420
421Args:
422 projectId: string, Project ID of the routines to list (required)
423 datasetId: string, Dataset ID of the routines to list (required)
424 pageToken: string, Page token, returned by a previous call, to request the next page of
425results
426 maxResults: integer, The maximum number of results per page.
427
428Returns:
429 An object of the form:
430
431 {
432 "nextPageToken": "A String", # A token to request the next page of results.
433 "routines": [ # Routines in the requested dataset. Only the following fields are populated:
434 # etag, project_id, dataset_id, routine_id, routine_type, creation_time,
435 # last_modified_time, language.
436 { # A user-defined function or a stored procedure.
437 "routineType": "A String", # Required.
438 "language": "A String", # Optional. Defaults to "SQL".
439 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
440 # the epoch.
441 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
442 # imported JAVASCRIPT libraries.
443 "A String",
444 ],
445 "routineReference": { # Required. Reference describing the ID of this routine.
446 "projectId": "A String", # [Required] The ID of the project containing this routine.
447 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
448 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
449 },
450 "etag": "A String", # Output only. A hash of this resource.
451 "arguments": [ # Optional.
452 { # Input/output argument of a function or a stored procedure.
453 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
454 # Examples:
455 # INT64: {type_kind="INT64"}
456 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
457 # STRUCT<x STRING, y ARRAY<DATE>>:
458 # {type_kind="STRUCT",
459 # struct_type={fields=[
460 # {name="x", type={type_kind="STRING"}},
461 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
462 # ]}}
463 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
464 "fields": [
465 # Object with schema name: StandardSqlField
466 ],
467 },
468 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
469 "typeKind": "A String", # Required. The top level type of this field.
470 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
471 },
472 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
473 "mode": "A String", # Optional. Specifies whether the argument is input or output.
474 # Can be set for procedures only.
475 "name": "A String", # Optional. The name of this argument. Can be absent for function return
476 # argument.
477 },
478 ],
479 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
480 # If absent, the return type is inferred from definition_body at query time
481 # in each query that references this routine. If present, then the evaluated
482 # result will be cast to the specified returned type at query time.
483 #
484 # For example, for the functions created with the following statements
485 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
486 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
487 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
488 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
489 # is absent for Increment (inferred as FLOAT64 at query time).
490 # Suppose the function Add is replaced by
491 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
492 # Then the inferred return type of Increment is automatically changed to
493 # INT64 at query time, while the return type of Decrement remains FLOAT64.
494 # Examples:
495 # INT64: {type_kind="INT64"}
496 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
497 # STRUCT<x STRING, y ARRAY<DATE>>:
498 # {type_kind="STRUCT",
499 # struct_type={fields=[
500 # {name="x", type={type_kind="STRING"}},
501 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
502 # ]}}
503 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
504 "fields": [
505 # Object with schema name: StandardSqlField
506 ],
507 },
508 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
509 "typeKind": "A String", # Required. The top level type of this field.
510 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
511 },
512 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
513 # since the epoch.
514 "definitionBody": "A String", # Required. The body of the routine.
515 # For functions, this is the expression in the AS clause.
516 # If language=SQL, it is the substring inside (but excluding) the
517 # parentheses. For example, for the function created with the following
518 # statement
519 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
520 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
521 # linebreak).
522 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
523 # For example, for the function created with the following statement
524 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
525 # definition_body = 'return "\n";\n' (both \n are replaced with
526 # linebreaks).
527 },
528 ],
529 }</pre>
530</div>
531
532<div class="method">
533 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
534 <pre>Retrieves the next page of results.
535
536Args:
537 previous_request: The request for the previous page. (required)
538 previous_response: The response from the request for the previous page. (required)
539
540Returns:
541 A request object that you can call 'execute()' on to request the next
542 page. Returns None if there are no more items in the collection.
543 </pre>
544</div>
545
546<div class="method">
547 <code class="details" id="update">update(projectId, datasetId, routineId, body)</code>
548 <pre>Updates information in an existing routine. The update method replaces the
549entire Routine resource.
550
551Args:
552 projectId: string, Project ID of the routine to update (required)
553 datasetId: string, Dataset ID of the routine to update (required)
554 routineId: string, Routine ID of the routine to update (required)
555 body: object, The request body. (required)
556 The object takes the form of:
557
558{ # A user-defined function or a stored procedure.
559 "routineType": "A String", # Required.
560 "language": "A String", # Optional. Defaults to "SQL".
561 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
562 # the epoch.
563 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
564 # imported JAVASCRIPT libraries.
565 "A String",
566 ],
567 "routineReference": { # Required. Reference describing the ID of this routine.
568 "projectId": "A String", # [Required] The ID of the project containing this routine.
569 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
570 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
571 },
572 "etag": "A String", # Output only. A hash of this resource.
573 "arguments": [ # Optional.
574 { # Input/output argument of a function or a stored procedure.
575 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
576 # Examples:
577 # INT64: {type_kind="INT64"}
578 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
579 # STRUCT<x STRING, y ARRAY<DATE>>:
580 # {type_kind="STRUCT",
581 # struct_type={fields=[
582 # {name="x", type={type_kind="STRING"}},
583 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
584 # ]}}
585 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
586 "fields": [
587 # Object with schema name: StandardSqlField
588 ],
589 },
590 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
591 "typeKind": "A String", # Required. The top level type of this field.
592 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
593 },
594 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
595 "mode": "A String", # Optional. Specifies whether the argument is input or output.
596 # Can be set for procedures only.
597 "name": "A String", # Optional. The name of this argument. Can be absent for function return
598 # argument.
599 },
600 ],
601 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
602 # If absent, the return type is inferred from definition_body at query time
603 # in each query that references this routine. If present, then the evaluated
604 # result will be cast to the specified returned type at query time.
605 #
606 # For example, for the functions created with the following statements
607 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
608 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
609 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
610 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
611 # is absent for Increment (inferred as FLOAT64 at query time).
612 # Suppose the function Add is replaced by
613 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
614 # Then the inferred return type of Increment is automatically changed to
615 # INT64 at query time, while the return type of Decrement remains FLOAT64.
616 # Examples:
617 # INT64: {type_kind="INT64"}
618 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
619 # STRUCT<x STRING, y ARRAY<DATE>>:
620 # {type_kind="STRUCT",
621 # struct_type={fields=[
622 # {name="x", type={type_kind="STRING"}},
623 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
624 # ]}}
625 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
626 "fields": [
627 # Object with schema name: StandardSqlField
628 ],
629 },
630 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
631 "typeKind": "A String", # Required. The top level type of this field.
632 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
633 },
634 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
635 # since the epoch.
636 "definitionBody": "A String", # Required. The body of the routine.
637 # For functions, this is the expression in the AS clause.
638 # If language=SQL, it is the substring inside (but excluding) the
639 # parentheses. For example, for the function created with the following
640 # statement
641 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
642 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
643 # linebreak).
644 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
645 # For example, for the function created with the following statement
646 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
647 # definition_body = 'return "\n";\n' (both \n are replaced with
648 # linebreaks).
649 }
650
651
652Returns:
653 An object of the form:
654
655 { # A user-defined function or a stored procedure.
656 "routineType": "A String", # Required.
657 "language": "A String", # Optional. Defaults to "SQL".
658 "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since
659 # the epoch.
660 "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the
661 # imported JAVASCRIPT libraries.
662 "A String",
663 ],
664 "routineReference": { # Required. Reference describing the ID of this routine.
665 "projectId": "A String", # [Required] The ID of the project containing this routine.
666 "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters.
667 "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
668 },
669 "etag": "A String", # Output only. A hash of this resource.
670 "arguments": [ # Optional.
671 { # Input/output argument of a function or a stored procedure.
672 "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
673 # Examples:
674 # INT64: {type_kind="INT64"}
675 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
676 # STRUCT<x STRING, y ARRAY<DATE>>:
677 # {type_kind="STRUCT",
678 # struct_type={fields=[
679 # {name="x", type={type_kind="STRING"}},
680 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
681 # ]}}
682 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
683 "fields": [
684 # Object with schema name: StandardSqlField
685 ],
686 },
687 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
688 "typeKind": "A String", # Required. The top level type of this field.
689 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
690 },
691 "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
692 "mode": "A String", # Optional. Specifies whether the argument is input or output.
693 # Can be set for procedures only.
694 "name": "A String", # Optional. The name of this argument. Can be absent for function return
695 # argument.
696 },
697 ],
698 "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise.
699 # If absent, the return type is inferred from definition_body at query time
700 # in each query that references this routine. If present, then the evaluated
701 # result will be cast to the specified returned type at query time.
702 #
703 # For example, for the functions created with the following statements
704 # CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);
705 # CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));
706 # CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));
707 # The return_type is {type_kind: "FLOAT64"} for Add and Decrement, and
708 # is absent for Increment (inferred as FLOAT64 at query time).
709 # Suppose the function Add is replaced by
710 # CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);
711 # Then the inferred return type of Increment is automatically changed to
712 # INT64 at query time, while the return type of Decrement remains FLOAT64.
713 # Examples:
714 # INT64: {type_kind="INT64"}
715 # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"}
716 # STRUCT<x STRING, y ARRAY<DATE>>:
717 # {type_kind="STRUCT",
718 # struct_type={fields=[
719 # {name="x", type={type_kind="STRING"}},
720 # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}}
721 # ]}}
722 "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
723 "fields": [
724 # Object with schema name: StandardSqlField
725 ],
726 },
727 "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
728 "typeKind": "A String", # Required. The top level type of this field.
729 # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
730 },
731 "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds
732 # since the epoch.
733 "definitionBody": "A String", # Required. The body of the routine.
734 # For functions, this is the expression in the AS clause.
735 # If language=SQL, it is the substring inside (but excluding) the
736 # parentheses. For example, for the function created with the following
737 # statement
738 # create function JoinLines(x string, y string) as (concat(x, "\n", y))
739 # definition_body = r'concat(x, "\n", y)' (\n is not replaced with
740 # linebreak).
741 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
742 # For example, for the function created with the following statement
743 # CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'
744 # definition_body = 'return "\n";\n' (both \n are replaced with
745 # linebreaks).
746 }</pre>
747</div>
748
749</body></html>