blob: e45766f9b383d172c2e200cb80ec618da7cef018 [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 Kim4ed7d3f2020-05-27 12:20:54 -070087 <code><a href="#list">list(projectId, datasetId, pageToken=None, maxResults=None, readMask=None, filter=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 Kim4ed7d3f2020-05-27 12:20:54 -0700122 &quot;arguments&quot;: [ # Optional.
123 { # Input/output argument of a function or a stored procedure.
124 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
125 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
126 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
127 # Can be set for procedures only.
128 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
129 # Examples:
130 # INT64: {type_kind=&quot;INT64&quot;}
131 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
132 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
133 # {type_kind=&quot;STRUCT&quot;,
134 # struct_type={fields=[
135 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
136 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
137 # ]}}
138 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
139 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
140 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
141 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
142 &quot;fields&quot;: [
143 # Object with schema name: StandardSqlField
144 ],
145 },
146 },
147 },
148 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700149 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700150 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700151 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700152 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700153 &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 -0700154 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700155 # If absent, the return type is inferred from definition_body at query time
156 # in each query that references this routine. If present, then the evaluated
157 # result will be cast to the specified returned type at query time.
158 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700159 # For example, for the functions created with the following statements:
160 #
161 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
162 #
163 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
164 #
165 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
166 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700167 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700168 # is absent for `Increment` (inferred as FLOAT64 at query time).
169 #
170 # Suppose the function `Add` is replaced by
171 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
172 #
173 # Then the inferred return type of `Increment` is automatically changed to
174 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700175 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700176 # INT64: {type_kind=&quot;INT64&quot;}
177 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700178 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700179 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700180 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700181 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
182 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700183 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700184 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
185 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
186 # 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 -0700187 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
188 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700189 # Object with schema name: StandardSqlField
190 ],
191 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700192 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700193 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700194 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
195 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700196 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
197 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
198 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700199 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700200 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700201 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700202 # If language=SQL, it is the substring inside (but excluding) the
203 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700204 # statement:
205 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700206 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700207 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700208 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700209 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700210 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700211 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700212 # For example, for the function created with the following statement:
213 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700214 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700215 #
216 # The definition_body is
217 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700218 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700219 #
220 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700221 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
222 # the epoch.
223 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
224 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
225 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
226 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
227 &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.
228 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700229 }</pre>
230</div>
231
232<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700233 <code class="details" id="insert">insert(projectId, datasetId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700234 <pre>Creates a new routine in the dataset.
235
236Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700237 projectId: string, Required. Project ID of the new routine (required)
238 datasetId: string, Required. Dataset ID of the new routine (required)
239 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700240 The object takes the form of:
241
242{ # A user-defined function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700243 &quot;arguments&quot;: [ # Optional.
244 { # Input/output argument of a function or a stored procedure.
245 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
246 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
247 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
248 # Can be set for procedures only.
249 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
250 # Examples:
251 # INT64: {type_kind=&quot;INT64&quot;}
252 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
253 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
254 # {type_kind=&quot;STRUCT&quot;,
255 # struct_type={fields=[
256 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
257 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
258 # ]}}
259 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
260 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
261 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
262 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
263 &quot;fields&quot;: [
264 # Object with schema name: StandardSqlField
265 ],
266 },
267 },
268 },
269 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700270 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700271 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700272 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700273 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700274 &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 -0700275 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700276 # If absent, the return type is inferred from definition_body at query time
277 # in each query that references this routine. If present, then the evaluated
278 # result will be cast to the specified returned type at query time.
279 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700280 # For example, for the functions created with the following statements:
281 #
282 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
283 #
284 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
285 #
286 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
287 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700288 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700289 # is absent for `Increment` (inferred as FLOAT64 at query time).
290 #
291 # Suppose the function `Add` is replaced by
292 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
293 #
294 # Then the inferred return type of `Increment` is automatically changed to
295 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700296 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700297 # INT64: {type_kind=&quot;INT64&quot;}
298 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700299 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700300 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700301 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700302 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
303 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700304 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700305 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
306 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
307 # 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 -0700308 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
309 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700310 # Object with schema name: StandardSqlField
311 ],
312 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700313 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700314 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700315 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
316 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700317 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
318 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
319 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700320 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700321 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700322 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700323 # If language=SQL, it is the substring inside (but excluding) the
324 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700325 # statement:
326 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700327 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700328 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700329 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700330 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700331 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700332 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700333 # For example, for the function created with the following statement:
334 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700335 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700336 #
337 # The definition_body is
338 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700339 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700340 #
341 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700342 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
343 # the epoch.
344 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
345 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
346 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
347 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
348 &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.
349 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700350 }
351
352
353Returns:
354 An object of the form:
355
356 { # A user-defined function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700357 &quot;arguments&quot;: [ # Optional.
358 { # Input/output argument of a function or a stored procedure.
359 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
360 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
361 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
362 # Can be set for procedures only.
363 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
364 # Examples:
365 # INT64: {type_kind=&quot;INT64&quot;}
366 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
367 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
368 # {type_kind=&quot;STRUCT&quot;,
369 # struct_type={fields=[
370 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
371 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
372 # ]}}
373 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
374 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
375 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
376 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
377 &quot;fields&quot;: [
378 # Object with schema name: StandardSqlField
379 ],
380 },
381 },
382 },
383 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700384 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700385 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700386 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700387 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700388 &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 -0700389 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700390 # If absent, the return type is inferred from definition_body at query time
391 # in each query that references this routine. If present, then the evaluated
392 # result will be cast to the specified returned type at query time.
393 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700394 # For example, for the functions created with the following statements:
395 #
396 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
397 #
398 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
399 #
400 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
401 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700402 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700403 # is absent for `Increment` (inferred as FLOAT64 at query time).
404 #
405 # Suppose the function `Add` is replaced by
406 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
407 #
408 # Then the inferred return type of `Increment` is automatically changed to
409 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700410 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700411 # INT64: {type_kind=&quot;INT64&quot;}
412 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700413 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700414 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700415 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700416 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
417 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700418 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700419 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
420 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
421 # 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 -0700422 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
423 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700424 # Object with schema name: StandardSqlField
425 ],
426 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700427 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700428 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700429 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
430 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700431 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
432 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
433 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700434 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700435 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700436 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700437 # If language=SQL, it is the substring inside (but excluding) the
438 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700439 # statement:
440 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700441 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700442 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700443 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700444 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700445 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700446 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700447 # For example, for the function created with the following statement:
448 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700449 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700450 #
451 # The definition_body is
452 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700453 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700454 #
455 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700456 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
457 # the epoch.
458 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
459 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
460 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
461 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
462 &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.
463 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700464 }</pre>
465</div>
466
467<div class="method">
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700468 <code class="details" id="list">list(projectId, datasetId, pageToken=None, maxResults=None, readMask=None, filter=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700469 <pre>Lists all routines in the specified dataset. Requires the READER dataset
470role.
471
472Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700473 projectId: string, Required. Project ID of the routines to list (required)
474 datasetId: string, Required. Dataset ID of the routines to list (required)
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700475 pageToken: string, Page token, returned by a previous call, to request the next page of
476results
477 maxResults: integer, The maximum number of results to return in a single response page.
478Leverage the page tokens to iterate through the entire collection.
Dan O'Mearadd494642020-05-01 07:42:23 -0700479 readMask: string, If set, then only the Routine fields in the field mask, as well as
480project_id, dataset_id and routine_id, are returned in the response.
481If unset, then the following Routine fields are returned:
482etag, project_id, dataset_id, routine_id, routine_type, creation_time,
483last_modified_time, and language.
Bu Sun Kim65020912020-05-20 12:08:20 -0700484 filter: string, If set, then only the Routines matching this filter are returned.
485The current supported form is either &quot;routine_type:&lt;RoutineType&gt;&quot; or
486&quot;routineType:&lt;RoutineType&gt;&quot;, where &lt;RoutineType&gt; is a RoutineType enum.
487Example: &quot;routineType:SCALAR_FUNCTION&quot;.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700488
489Returns:
490 An object of the form:
491
492 {
Bu Sun Kim65020912020-05-20 12:08:20 -0700493 &quot;routines&quot;: [ # Routines in the requested dataset. Unless read_mask is set in the request,
Dan O'Mearadd494642020-05-01 07:42:23 -0700494 # only the following fields are populated:
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700495 # etag, project_id, dataset_id, routine_id, routine_type, creation_time,
Dan O'Mearadd494642020-05-01 07:42:23 -0700496 # last_modified_time, and language.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700497 { # A user-defined function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700498 &quot;arguments&quot;: [ # Optional.
499 { # Input/output argument of a function or a stored procedure.
500 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
501 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
502 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
503 # Can be set for procedures only.
504 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
505 # Examples:
506 # INT64: {type_kind=&quot;INT64&quot;}
507 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
508 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
509 # {type_kind=&quot;STRUCT&quot;,
510 # struct_type={fields=[
511 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
512 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
513 # ]}}
514 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
515 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
516 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
517 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
518 &quot;fields&quot;: [
519 # Object with schema name: StandardSqlField
520 ],
521 },
522 },
523 },
524 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700525 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700526 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700527 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700528 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700529 &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 -0700530 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700531 # If absent, the return type is inferred from definition_body at query time
532 # in each query that references this routine. If present, then the evaluated
533 # result will be cast to the specified returned type at query time.
534 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700535 # For example, for the functions created with the following statements:
536 #
537 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
538 #
539 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
540 #
541 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
542 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700543 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700544 # is absent for `Increment` (inferred as FLOAT64 at query time).
545 #
546 # Suppose the function `Add` is replaced by
547 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
548 #
549 # Then the inferred return type of `Increment` is automatically changed to
550 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700551 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700552 # INT64: {type_kind=&quot;INT64&quot;}
553 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700554 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700555 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700556 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700557 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
558 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700559 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700560 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
561 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
562 # 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 -0700563 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
564 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700565 # Object with schema name: StandardSqlField
566 ],
567 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700568 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700569 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700570 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
571 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700572 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
573 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
574 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700575 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700576 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700577 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700578 # If language=SQL, it is the substring inside (but excluding) the
579 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700580 # statement:
581 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700582 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700583 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700584 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700585 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700586 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700587 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700588 # For example, for the function created with the following statement:
589 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700590 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700591 #
592 # The definition_body is
593 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700594 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700595 #
596 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700597 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
598 # the epoch.
599 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
600 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
601 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
602 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
603 &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.
604 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700605 },
606 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700607 &quot;nextPageToken&quot;: &quot;A String&quot;, # A token to request the next page of results.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700608 }</pre>
609</div>
610
611<div class="method">
612 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
613 <pre>Retrieves the next page of results.
614
615Args:
616 previous_request: The request for the previous page. (required)
617 previous_response: The response from the request for the previous page. (required)
618
619Returns:
Bu Sun Kim65020912020-05-20 12:08:20 -0700620 A request object that you can call &#x27;execute()&#x27; on to request the next
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700621 page. Returns None if there are no more items in the collection.
622 </pre>
623</div>
624
625<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700626 <code class="details" id="update">update(projectId, datasetId, routineId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700627 <pre>Updates information in an existing routine. The update method replaces the
628entire Routine resource.
629
630Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700631 projectId: string, Required. Project ID of the routine to update (required)
632 datasetId: string, Required. Dataset ID of the routine to update (required)
633 routineId: string, Required. Routine ID of the routine to update (required)
634 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700635 The object takes the form of:
636
637{ # A user-defined function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700638 &quot;arguments&quot;: [ # Optional.
639 { # Input/output argument of a function or a stored procedure.
640 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
641 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
642 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
643 # Can be set for procedures only.
644 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
645 # Examples:
646 # INT64: {type_kind=&quot;INT64&quot;}
647 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
648 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
649 # {type_kind=&quot;STRUCT&quot;,
650 # struct_type={fields=[
651 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
652 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
653 # ]}}
654 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
655 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
656 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
657 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
658 &quot;fields&quot;: [
659 # Object with schema name: StandardSqlField
660 ],
661 },
662 },
663 },
664 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700665 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700666 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700667 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700668 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700669 &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 -0700670 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700671 # If absent, the return type is inferred from definition_body at query time
672 # in each query that references this routine. If present, then the evaluated
673 # result will be cast to the specified returned type at query time.
674 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700675 # For example, for the functions created with the following statements:
676 #
677 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
678 #
679 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
680 #
681 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
682 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700683 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700684 # is absent for `Increment` (inferred as FLOAT64 at query time).
685 #
686 # Suppose the function `Add` is replaced by
687 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
688 #
689 # Then the inferred return type of `Increment` is automatically changed to
690 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700691 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700692 # INT64: {type_kind=&quot;INT64&quot;}
693 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700694 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700695 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700696 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700697 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
698 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700699 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700700 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
701 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
702 # 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 -0700703 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
704 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700705 # Object with schema name: StandardSqlField
706 ],
707 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700708 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700709 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700710 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
711 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700712 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
713 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
714 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700715 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700716 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700717 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700718 # If language=SQL, it is the substring inside (but excluding) the
719 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700720 # statement:
721 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700722 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700723 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700724 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700725 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700726 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700727 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700728 # For example, for the function created with the following statement:
729 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700730 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700731 #
732 # The definition_body is
733 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700734 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700735 #
736 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700737 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
738 # the epoch.
739 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
740 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
741 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
742 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
743 &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.
744 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700745 }
746
747
748Returns:
749 An object of the form:
750
751 { # A user-defined function or a stored procedure.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700752 &quot;arguments&quot;: [ # Optional.
753 { # Input/output argument of a function or a stored procedure.
754 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
755 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
756 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output.
757 # Can be set for procedures only.
758 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE.
759 # Examples:
760 # INT64: {type_kind=&quot;INT64&quot;}
761 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
762 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
763 # {type_kind=&quot;STRUCT&quot;,
764 # struct_type={fields=[
765 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
766 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
767 # ]}}
768 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
769 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
770 # Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
771 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
772 &quot;fields&quot;: [
773 # Object with schema name: StandardSqlField
774 ],
775 },
776 },
777 },
778 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700779 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700780 # imported JAVASCRIPT libraries.
Bu Sun Kim65020912020-05-20 12:08:20 -0700781 &quot;A String&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700782 ],
Bu Sun Kim65020912020-05-20 12:08:20 -0700783 &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 -0700784 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700785 # If absent, the return type is inferred from definition_body at query time
786 # in each query that references this routine. If present, then the evaluated
787 # result will be cast to the specified returned type at query time.
788 #
Dan O'Mearadd494642020-05-01 07:42:23 -0700789 # For example, for the functions created with the following statements:
790 #
791 # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);`
792 #
793 # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));`
794 #
795 # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));`
796 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700797 # The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and
Dan O'Mearadd494642020-05-01 07:42:23 -0700798 # is absent for `Increment` (inferred as FLOAT64 at query time).
799 #
800 # Suppose the function `Add` is replaced by
801 # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);`
802 #
803 # Then the inferred return type of `Increment` is automatically changed to
804 # INT64 at query time, while the return type of `Decrement` remains FLOAT64.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700805 # Examples:
Bu Sun Kim65020912020-05-20 12:08:20 -0700806 # INT64: {type_kind=&quot;INT64&quot;}
807 # ARRAY&lt;STRING&gt;: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;}
Dan O'Mearadd494642020-05-01 07:42:23 -0700808 # STRUCT&lt;x STRING, y ARRAY&lt;DATE&gt;&gt;:
Bu Sun Kim65020912020-05-20 12:08:20 -0700809 # {type_kind=&quot;STRUCT&quot;,
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700810 # struct_type={fields=[
Bu Sun Kim65020912020-05-20 12:08:20 -0700811 # {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}},
812 # {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}}
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700813 # ]}}
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700814 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
815 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field.
816 # 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 -0700817 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
818 &quot;fields&quot;: [
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700819 # Object with schema name: StandardSqlField
820 ],
821 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700822 },
Bu Sun Kim65020912020-05-20 12:08:20 -0700823 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -0700824 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds
825 # since the epoch.
Bu Sun Kim65020912020-05-20 12:08:20 -0700826 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
827 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
828 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine.
Dan O'Mearadd494642020-05-01 07:42:23 -0700829 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700830 # For functions, this is the expression in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700831 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700832 # If language=SQL, it is the substring inside (but excluding) the
833 # parentheses. For example, for the function created with the following
Dan O'Mearadd494642020-05-01 07:42:23 -0700834 # statement:
835 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700836 # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))`
Dan O'Mearadd494642020-05-01 07:42:23 -0700837 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700838 # The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700839 # linebreak).
Dan O'Mearadd494642020-05-01 07:42:23 -0700840 #
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700841 # If language=JAVASCRIPT, it is the evaluated string in the AS clause.
Dan O'Mearadd494642020-05-01 07:42:23 -0700842 # For example, for the function created with the following statement:
843 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700844 # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;`
Dan O'Mearadd494642020-05-01 07:42:23 -0700845 #
846 # The definition_body is
847 #
Bu Sun Kim65020912020-05-20 12:08:20 -0700848 # `return &quot;\n&quot;;\n`
Dan O'Mearadd494642020-05-01 07:42:23 -0700849 #
850 # Note that both \n are replaced with linebreaks.
Bu Sun Kim65020912020-05-20 12:08:20 -0700851 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since
852 # the epoch.
853 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
854 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
855 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
856 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
857 &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.
858 },
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700859 }</pre>
860</div>
861
862</body></html>