blob: 04e89fa9860f0869c4170ee9b60fa31607f85825 [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">
Dan O'Mearadd494642020-05-01 07:42:23 -070081 <code><a href="#get">get(projectId, datasetId, routineId, readMask=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070082<p class="firstline">Gets the specified routine resource by routine ID.</p>
83<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070084 <code><a href="#insert">insert(projectId, datasetId, body=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070085<p class="firstline">Creates a new routine in the dataset.</p>
86<p class="toc_element">
Bu Sun Kimd059ad82020-07-22 17:02:09 -070087 <code><a href="#list">list(projectId, datasetId, readMask=None, filter=None, pageToken=None, maxResults=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070088<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">
Dan O'Mearadd494642020-05-01 07:42:23 -070093 <code><a href="#update">update(projectId, datasetId, routineId, body=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070094<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:
Dan O'Mearadd494642020-05-01 07:42:23 -0700101 projectId: string, Required. Project ID of the routine to delete (required)
102 datasetId: string, Required. Dataset ID of the routine to delete (required)
103 routineId: string, Required. Routine ID of the routine to delete (required)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700104</pre>
105</div>
106
107<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700108 <code class="details" id="get">get(projectId, datasetId, routineId, readMask=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700109 <pre>Gets the specified routine resource by routine ID.
110
111Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700112 projectId: string, Required. Project ID of the requested routine (required)
113 datasetId: string, Required. Dataset ID of the requested routine (required)
114 routineId: string, Required. Routine ID of the requested routine (required)
115 readMask: string, If set, only the Routine fields in the field mask are returned in the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700116response. 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.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700122 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
123 #
124 # For functions, this is the expression in the AS clause.
125 #
126 # If language=SQL, it is the substring inside (but excluding) the
127 # parentheses. For example, for the function created with the following
128 # statement:
129 #
130 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
131 #
132 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
133 # linebreak).
134 #
135 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
136 # For example, for the function created with the following statement:
137 #
138 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
139 #
140 # The definition_body is
141 #
142 # `return &quot;\n&quot;;\n`
143 #
144 # Note that both \n are replaced with linebreaks.
145 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
146 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
147 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
148 &quot;routineId&quot;: &quot;A String&quot;, # [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.
149 },
150 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
151 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
152 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
153 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
154 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
155 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
156 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700157 &quot;arguments&quot;: [ # Optional.
158 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700159 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
160 # Examples:
161 # INT64: {type_kind=&quot;INT64&quot;}
162 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
163 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
164 # {type_kind=&quot;STRUCT&quot;,
165 # struct_type={fields=[
166 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
167 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
168 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700169 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
170 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
171 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
172 &quot;fields&quot;: [
173 # Object with schema name: StandardSqlField
174 ],
175 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700176 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700177 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700178 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
179 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
180 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
181 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700182 },
183 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700184 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700185 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700186 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700187 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700188 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700189 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700190 # If absent, the return type is inferred from definition_body at query time
191 # in each query that references this routine. If present, then the evaluated
192 # result will be cast to the specified returned type at query time.
193 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700194 # For example, for the functions created with the following statements:
195 #
196 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
197 #
198 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
199 #
200 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
201 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700202 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700203 # is absent for `Increment` (inferred as FLOAT64 at query time).
204 #
205 # Suppose the function `Add` is replaced by
206 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
207 #
208 # Then the inferred return type of `Increment` is automatically changed to
209 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700210 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700211 # INT64: {type_kind=&quot;INT64&quot;}
212 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700213 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700214 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700215 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700216 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
217 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700218 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700219 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
220 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700221 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
222 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700223 # Object with schema name: StandardSqlField
224 ],
225 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700226 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700227 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700228 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
229 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700230 }</pre>
231</div>
232
233<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700234 <code class="details" id="insert">insert(projectId, datasetId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700235 <pre>Creates a new routine in the dataset.
236
237Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700238 projectId: string, Required. Project ID of the new routine (required)
239 datasetId: string, Required. Dataset ID of the new routine (required)
240 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700241 The object takes the form of:
242
243{ # A user-defined function or a stored procedure.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700244 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
245 #
246 # For functions, this is the expression in the AS clause.
247 #
248 # If language=SQL, it is the substring inside (but excluding) the
249 # parentheses. For example, for the function created with the following
250 # statement:
251 #
252 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
253 #
254 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
255 # linebreak).
256 #
257 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
258 # For example, for the function created with the following statement:
259 #
260 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
261 #
262 # The definition_body is
263 #
264 # `return &quot;\n&quot;;\n`
265 #
266 # Note that both \n are replaced with linebreaks.
267 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
268 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
269 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
270 &quot;routineId&quot;: &quot;A String&quot;, # [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.
271 },
272 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
273 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
274 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
275 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
276 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
277 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
278 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700279 &quot;arguments&quot;: [ # Optional.
280 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700281 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
282 # Examples:
283 # INT64: {type_kind=&quot;INT64&quot;}
284 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
285 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
286 # {type_kind=&quot;STRUCT&quot;,
287 # struct_type={fields=[
288 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
289 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
290 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700291 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
292 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
293 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
294 &quot;fields&quot;: [
295 # Object with schema name: StandardSqlField
296 ],
297 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700298 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700299 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700300 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
301 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
302 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
303 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700304 },
305 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700306 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700307 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700308 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700309 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700310 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700311 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700312 # If absent, the return type is inferred from definition_body at query time
313 # in each query that references this routine. If present, then the evaluated
314 # result will be cast to the specified returned type at query time.
315 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700316 # For example, for the functions created with the following statements:
317 #
318 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
319 #
320 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
321 #
322 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
323 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700324 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700325 # is absent for `Increment` (inferred as FLOAT64 at query time).
326 #
327 # Suppose the function `Add` is replaced by
328 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
329 #
330 # Then the inferred return type of `Increment` is automatically changed to
331 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700332 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700333 # INT64: {type_kind=&quot;INT64&quot;}
334 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700335 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700336 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700337 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700338 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
339 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700340 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700341 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
342 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700343 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
344 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700345 # Object with schema name: StandardSqlField
346 ],
347 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700348 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700349 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700350 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
351 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700352 }
353
354
355Returns:
356 An object of the form:
357
358 { # A user-defined function or a stored procedure.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700359 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
360 #
361 # For functions, this is the expression in the AS clause.
362 #
363 # If language=SQL, it is the substring inside (but excluding) the
364 # parentheses. For example, for the function created with the following
365 # statement:
366 #
367 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
368 #
369 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
370 # linebreak).
371 #
372 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
373 # For example, for the function created with the following statement:
374 #
375 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
376 #
377 # The definition_body is
378 #
379 # `return &quot;\n&quot;;\n`
380 #
381 # Note that both \n are replaced with linebreaks.
382 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
383 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
384 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
385 &quot;routineId&quot;: &quot;A String&quot;, # [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.
386 },
387 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
388 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
389 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
390 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
391 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
392 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
393 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700394 &quot;arguments&quot;: [ # Optional.
395 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700396 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
397 # Examples:
398 # INT64: {type_kind=&quot;INT64&quot;}
399 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
400 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
401 # {type_kind=&quot;STRUCT&quot;,
402 # struct_type={fields=[
403 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
404 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
405 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700406 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
407 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
408 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
409 &quot;fields&quot;: [
410 # Object with schema name: StandardSqlField
411 ],
412 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700413 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700414 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700415 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
416 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
417 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
418 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700419 },
420 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700421 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700422 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700423 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700424 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700425 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700426 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700427 # If absent, the return type is inferred from definition_body at query time
428 # in each query that references this routine. If present, then the evaluated
429 # result will be cast to the specified returned type at query time.
430 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700431 # For example, for the functions created with the following statements:
432 #
433 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
434 #
435 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
436 #
437 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
438 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700439 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700440 # is absent for `Increment` (inferred as FLOAT64 at query time).
441 #
442 # Suppose the function `Add` is replaced by
443 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
444 #
445 # Then the inferred return type of `Increment` is automatically changed to
446 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700447 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700448 # INT64: {type_kind=&quot;INT64&quot;}
449 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700450 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700451 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700452 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700453 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
454 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700455 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700456 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
457 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700458 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
459 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700460 # Object with schema name: StandardSqlField
461 ],
462 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700463 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700464 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700465 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
466 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700467 }</pre>
468</div>
469
470<div class="method">
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700471 <code class="details" id="list">list(projectId, datasetId, readMask=None, filter=None, pageToken=None, maxResults=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700472 <pre>Lists all routines in the specified dataset. Requires the READER dataset
473role.
474
475Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700476 projectId: string, Required. Project ID of the routines to list (required)
477 datasetId: string, Required. Dataset ID of the routines to list (required)
Dan O'Mearadd494642020-05-01 07:42:23 -0700478 readMask: string, If set, then only the Routine fields in the field mask, as well as
479project_id, dataset_id and routine_id, are returned in the response.
480If unset, then the following Routine fields are returned:
481etag, project_id, dataset_id, routine_id, routine_type, creation_time,
482last_modified_time, and language.
Bu Sun Kim65020912020-05-20 12:08:20 -0700483 filter: string, If set, then only the Routines matching this filter are returned.
484The current supported form is either &quot;routine_type:&lt;RoutineType&gt;&quot; or
485&quot;routineType:&lt;RoutineType&gt;&quot;, where &lt;RoutineType&gt; is a RoutineType enum.
486Example: &quot;routineType:SCALAR_FUNCTION&quot;.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700487 pageToken: string, Page token, returned by a previous call, to request the next page of
488results
489 maxResults: integer, The maximum number of results to return in a single response page.
490Leverage the page tokens to iterate through the entire collection.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700491
492Returns:
493 An object of the form:
494
495 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700496 &quot;routines&quot;: [ # Routines in the requested dataset. Unless read_mask is set in the request,
Dan O'Mearadd494642020-05-01 07:42:23 -0700497 # only the following fields are populated:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700498 # etag, project_id, dataset_id, routine_id, routine_type, creation_time,
Dan O'Mearadd494642020-05-01 07:42:23 -0700499 # last_modified_time, and language.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700500 { # A user-defined function or a stored procedure.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700501 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
502 #
503 # For functions, this is the expression in the AS clause.
504 #
505 # If language=SQL, it is the substring inside (but excluding) the
506 # parentheses. For example, for the function created with the following
507 # statement:
508 #
509 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
510 #
511 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
512 # linebreak).
513 #
514 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
515 # For example, for the function created with the following statement:
516 #
517 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
518 #
519 # The definition_body is
520 #
521 # `return &quot;\n&quot;;\n`
522 #
523 # Note that both \n are replaced with linebreaks.
524 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
525 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
526 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
527 &quot;routineId&quot;: &quot;A String&quot;, # [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.
528 },
529 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
530 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
531 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
532 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
533 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
534 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
535 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700536 &quot;arguments&quot;: [ # Optional.
537 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700538 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
539 # Examples:
540 # INT64: {type_kind=&quot;INT64&quot;}
541 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
542 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
543 # {type_kind=&quot;STRUCT&quot;,
544 # struct_type={fields=[
545 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
546 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
547 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700548 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
549 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
550 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
551 &quot;fields&quot;: [
552 # Object with schema name: StandardSqlField
553 ],
554 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700555 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700556 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700557 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
558 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
559 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
560 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700561 },
562 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700563 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700564 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700565 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700566 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700567 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700568 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700569 # If absent, the return type is inferred from definition_body at query time
570 # in each query that references this routine. If present, then the evaluated
571 # result will be cast to the specified returned type at query time.
572 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700573 # For example, for the functions created with the following statements:
574 #
575 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
576 #
577 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
578 #
579 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
580 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700581 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700582 # is absent for `Increment` (inferred as FLOAT64 at query time).
583 #
584 # Suppose the function `Add` is replaced by
585 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
586 #
587 # Then the inferred return type of `Increment` is automatically changed to
588 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700589 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700590 # INT64: {type_kind=&quot;INT64&quot;}
591 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700592 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700593 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700594 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700595 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
596 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700597 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700598 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
599 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700600 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
601 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700602 # Object with schema name: StandardSqlField
603 ],
604 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700605 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700606 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700607 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
608 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700609 },
610 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700611 &quot;nextPageToken&quot;: &quot;A String&quot;, # A token to request the next page of results.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700612 }</pre>
613</div>
614
615<div class="method">
616 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
617 <pre>Retrieves the next page of results.
618
619Args:
620 previous_request: The request for the previous page. (required)
621 previous_response: The response from the request for the previous page. (required)
622
623Returns:
Bu Sun Kim65020912020-05-20 12:08:20 -0700624 A request object that you can call &#x27;execute()&#x27; on to request the next
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700625 page. Returns None if there are no more items in the collection.
626 </pre>
627</div>
628
629<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700630 <code class="details" id="update">update(projectId, datasetId, routineId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700631 <pre>Updates information in an existing routine. The update method replaces the
632entire Routine resource.
633
634Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700635 projectId: string, Required. Project ID of the routine to update (required)
636 datasetId: string, Required. Dataset ID of the routine to update (required)
637 routineId: string, Required. Routine ID of the routine to update (required)
638 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700639 The object takes the form of:
640
641{ # A user-defined function or a stored procedure.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700642 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
643 #
644 # For functions, this is the expression in the AS clause.
645 #
646 # If language=SQL, it is the substring inside (but excluding) the
647 # parentheses. For example, for the function created with the following
648 # statement:
649 #
650 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
651 #
652 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
653 # linebreak).
654 #
655 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
656 # For example, for the function created with the following statement:
657 #
658 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
659 #
660 # The definition_body is
661 #
662 # `return &quot;\n&quot;;\n`
663 #
664 # Note that both \n are replaced with linebreaks.
665 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
666 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
667 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
668 &quot;routineId&quot;: &quot;A String&quot;, # [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.
669 },
670 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
671 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
672 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
673 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
674 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
675 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
676 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700677 &quot;arguments&quot;: [ # Optional.
678 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700679 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
680 # Examples:
681 # INT64: {type_kind=&quot;INT64&quot;}
682 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
683 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
684 # {type_kind=&quot;STRUCT&quot;,
685 # struct_type={fields=[
686 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
687 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
688 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700689 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
690 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
691 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
692 &quot;fields&quot;: [
693 # Object with schema name: StandardSqlField
694 ],
695 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700696 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700697 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700698 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
699 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
700 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
701 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700702 },
703 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700704 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700705 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700706 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700707 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700708 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700709 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700710 # If absent, the return type is inferred from definition_body at query time
711 # in each query that references this routine. If present, then the evaluated
712 # result will be cast to the specified returned type at query time.
713 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700714 # For example, for the functions created with the following statements:
715 #
716 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
717 #
718 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
719 #
720 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
721 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700722 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700723 # is absent for `Increment` (inferred as FLOAT64 at query time).
724 #
725 # Suppose the function `Add` is replaced by
726 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
727 #
728 # Then the inferred return type of `Increment` is automatically changed to
729 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700730 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700731 # INT64: {type_kind=&quot;INT64&quot;}
732 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700733 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700734 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700735 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700736 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
737 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700738 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700739 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
740 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700741 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
742 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700743 # Object with schema name: StandardSqlField
744 ],
745 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700746 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700747 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700748 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
749 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700750 }
751
752
753Returns:
754 An object of the form:
755
756 { # A user-defined function or a stored procedure.
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700757 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
758 #
759 # For functions, this is the expression in the AS clause.
760 #
761 # If language=SQL, it is the substring inside (but excluding) the
762 # parentheses. For example, for the function created with the following
763 # statement:
764 #
765 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
766 #
767 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
768 # linebreak).
769 #
770 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
771 # For example, for the function created with the following statement:
772 #
773 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
774 #
775 # The definition_body is
776 #
777 # `return &quot;\n&quot;;\n`
778 #
779 # Note that both \n are replaced with linebreaks.
780 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
781 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
782 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
783 &quot;routineId&quot;: &quot;A String&quot;, # [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.
784 },
785 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
786 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
787 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
788 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
789 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
790 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
791 # the epoch.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700792 &quot;arguments&quot;: [ # Optional.
793 { # Input/output argument of a function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700794 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
795 # Examples:
796 # INT64: {type_kind=&quot;INT64&quot;}
797 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
798 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
799 # {type_kind=&quot;STRUCT&quot;,
800 # struct_type={fields=[
801 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
802 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
803 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700804 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
805 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
806 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
807 &quot;fields&quot;: [
808 # Object with schema name: StandardSqlField
809 ],
810 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700811 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700812 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700813 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
814 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
815 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
816 # Can be set for procedures only.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700817 },
818 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700819 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700820 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700821 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700822 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700823 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. # Optional if language = &quot;SQL&quot;; required otherwise.
Dan O'Mearadd494642020-05-01 07:42:23 -0700824 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700825 # If absent, the return type is inferred from definition_body at query time
826 # in each query that references this routine. If present, then the evaluated
827 # result will be cast to the specified returned type at query time.
828 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700829 # For example, for the functions created with the following statements:
830 #
831 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
832 #
833 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
834 #
835 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
836 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700837 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700838 # is absent for `Increment` (inferred as FLOAT64 at query time).
839 #
840 # Suppose the function `Add` is replaced by
841 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
842 #
843 # Then the inferred return type of `Increment` is automatically changed to
844 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700845 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700846 # INT64: {type_kind=&quot;INT64&quot;}
847 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700848 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700849 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700850 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700851 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
852 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700853 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700854 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
855 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Bu Sun Kim65020912020-05-20 12:08:20 -0700856 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
857 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700858 # Object with schema name: StandardSqlField
859 ],
860 },
Bu Sun Kimd059ad82020-07-22 17:02:09 -0700861 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700862 },
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700863 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
864 # since the epoch.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700865 }</pre>
866</div>
867
868</body></html>