blob: 04e16c0b00f14e33802225e9548bfaeb1b9ddab6 [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">
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070078 <code><a href="#close">close()</a></code></p>
79<p class="firstline">Close httplib2 connections.</p>
80<p class="toc_element">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070081 <code><a href="#delete">delete(projectId, datasetId, routineId)</a></code></p>
82<p class="firstline">Deletes the routine specified by routineId from the dataset.</p>
83<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070084 <code><a href="#get">get(projectId, datasetId, routineId, readMask=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070085<p class="firstline">Gets the specified routine resource by routine ID.</p>
86<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070087 <code><a href="#insert">insert(projectId, datasetId, body=None)</a></code></p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070088<p class="firstline">Creates a new routine in the dataset.</p>
89<p class="toc_element">
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -080090 <code><a href="#list">list(projectId, datasetId, filter=None, maxResults=None, pageToken=None, readMask=None)</a></code></p>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070091<p class="firstline">Lists all routines in the specified dataset. Requires the READER dataset role.</p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070092<p class="toc_element">
93 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
94<p class="firstline">Retrieves the next page of results.</p>
95<p class="toc_element">
Dan O'Mearadd494642020-05-01 07:42:23 -070096 <code><a href="#update">update(projectId, datasetId, routineId, body=None)</a></code></p>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -070097<p class="firstline">Updates information in an existing routine. The update method replaces the entire Routine resource.</p>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -070098<h3>Method Details</h3>
99<div class="method">
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700100 <code class="details" id="close">close()</code>
101 <pre>Close httplib2 connections.</pre>
102</div>
103
104<div class="method">
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700105 <code class="details" id="delete">delete(projectId, datasetId, routineId)</code>
106 <pre>Deletes the routine specified by routineId from the dataset.
107
108Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700109 projectId: string, Required. Project ID of the routine to delete (required)
110 datasetId: string, Required. Dataset ID of the routine to delete (required)
111 routineId: string, Required. Routine ID of the routine to delete (required)
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700112</pre>
113</div>
114
115<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700116 <code class="details" id="get">get(projectId, datasetId, routineId, readMask=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700117 <pre>Gets the specified routine resource by routine ID.
118
119Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700120 projectId: string, Required. Project ID of the requested routine (required)
121 datasetId: string, Required. Dataset ID of the requested routine (required)
122 routineId: string, Required. Routine ID of the requested routine (required)
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700123 readMask: string, If set, only the Routine fields in the field mask are returned in the response. If unset, all Routine fields are returned.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700124
125Returns:
126 An object of the form:
127
128 { # A user-defined function or a stored procedure.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800129 &quot;arguments&quot;: [ # Optional.
130 { # Input/output argument of a function or a stored procedure.
131 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
132 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800133 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
134 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
135 &quot;fields&quot;: [
136 # Object with schema name: StandardSqlField
137 ],
138 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800139 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800140 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800141 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
142 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
143 },
144 ],
145 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
146 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
147 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
148 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
149 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
150 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
151 &quot;A String&quot;,
152 ],
153 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
154 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700155 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
156 &quot;columns&quot;: [ # The columns in this table type
157 { # A field or a column.
158 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
159 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
160 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
161 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
162 &quot;fields&quot;: [
163 # Object with schema name: StandardSqlField
164 ],
165 },
166 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
167 },
168 },
169 ],
170 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800171 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
172 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
173 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
174 &quot;fields&quot;: [
175 # Object with schema name: StandardSqlField
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800176 ],
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800177 },
178 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
179 },
180 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
181 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
182 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
183 &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.
184 },
185 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
186}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700187</div>
188
189<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700190 <code class="details" id="insert">insert(projectId, datasetId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700191 <pre>Creates a new routine in the dataset.
192
193Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700194 projectId: string, Required. Project ID of the new routine (required)
195 datasetId: string, Required. Dataset ID of the new routine (required)
196 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700197 The object takes the form of:
198
199{ # A user-defined function or a stored procedure.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800200 &quot;arguments&quot;: [ # Optional.
201 { # Input/output argument of a function or a stored procedure.
202 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
203 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800204 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
205 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
206 &quot;fields&quot;: [
207 # Object with schema name: StandardSqlField
208 ],
209 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800210 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800211 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800212 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
213 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
214 },
215 ],
216 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
217 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
218 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
219 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
220 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
221 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
222 &quot;A String&quot;,
223 ],
224 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
225 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700226 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
227 &quot;columns&quot;: [ # The columns in this table type
228 { # A field or a column.
229 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
230 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
231 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
232 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
233 &quot;fields&quot;: [
234 # Object with schema name: StandardSqlField
235 ],
236 },
237 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
238 },
239 },
240 ],
241 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800242 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
243 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
244 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
245 &quot;fields&quot;: [
246 # Object with schema name: StandardSqlField
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800247 ],
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800248 },
249 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
250 },
251 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
252 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
253 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
254 &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.
255 },
256 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
257}
258
259
260Returns:
261 An object of the form:
262
263 { # A user-defined function or a stored procedure.
264 &quot;arguments&quot;: [ # Optional.
265 { # Input/output argument of a function or a stored procedure.
266 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
267 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
268 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
269 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
270 &quot;fields&quot;: [
271 # Object with schema name: StandardSqlField
272 ],
273 },
274 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800275 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800276 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
277 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
278 },
279 ],
280 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
281 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
282 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
283 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
284 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
285 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
286 &quot;A String&quot;,
287 ],
288 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
289 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700290 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
291 &quot;columns&quot;: [ # The columns in this table type
292 { # A field or a column.
293 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
294 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
295 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
296 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
297 &quot;fields&quot;: [
298 # Object with schema name: StandardSqlField
299 ],
300 },
301 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
302 },
303 },
304 ],
305 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800306 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
307 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
308 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
309 &quot;fields&quot;: [
310 # Object with schema name: StandardSqlField
311 ],
312 },
313 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
314 },
315 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
316 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
317 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
318 &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.
319 },
320 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
321}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700322</div>
323
324<div class="method">
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800325 <code class="details" id="list">list(projectId, datasetId, filter=None, maxResults=None, pageToken=None, readMask=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700326 <pre>Lists all routines in the specified dataset. Requires the READER dataset role.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700327
328Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700329 projectId: string, Required. Project ID of the routines to list (required)
330 datasetId: string, Required. Dataset ID of the routines to list (required)
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800331 filter: string, If set, then only the Routines matching this filter are returned. The current supported form is either &quot;routine_type:&quot; or &quot;routineType:&quot;, where is a RoutineType enum. Example: &quot;routineType:SCALAR_FUNCTION&quot;.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800332 maxResults: integer, The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
333 pageToken: string, Page token, returned by a previous call, to request the next page of results
334 readMask: string, If set, then only the Routine fields in the field mask, as well as project_id, dataset_id and routine_id, are returned in the response. If unset, then the following Routine fields are returned: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, and language.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700335
336Returns:
337 An object of the form:
338
339 {
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800340 &quot;nextPageToken&quot;: &quot;A String&quot;, # A token to request the next page of results.
341 &quot;routines&quot;: [ # Routines in the requested dataset. Unless read_mask is set in the request, only the following fields are populated: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, and language.
342 { # A user-defined function or a stored procedure.
343 &quot;arguments&quot;: [ # Optional.
344 { # Input/output argument of a function or a stored procedure.
345 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
346 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800347 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
348 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
349 &quot;fields&quot;: [
350 # Object with schema name: StandardSqlField
351 ],
352 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800353 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800354 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800355 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
356 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800357 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800358 ],
359 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
360 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
361 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
362 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
363 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
364 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
365 &quot;A String&quot;,
366 ],
367 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
368 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700369 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
370 &quot;columns&quot;: [ # The columns in this table type
371 { # A field or a column.
372 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
373 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
374 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
375 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
376 &quot;fields&quot;: [
377 # Object with schema name: StandardSqlField
378 ],
379 },
380 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
381 },
382 },
383 ],
384 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800385 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
386 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
387 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
388 &quot;fields&quot;: [
389 # Object with schema name: StandardSqlField
390 ],
391 },
392 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
393 },
394 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
395 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
396 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
397 &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.
398 },
399 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
400 },
401 ],
402}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700403</div>
404
405<div class="method">
406 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
407 <pre>Retrieves the next page of results.
408
409Args:
410 previous_request: The request for the previous page. (required)
411 previous_response: The response from the request for the previous page. (required)
412
413Returns:
Bu Sun Kim65020912020-05-20 12:08:20 -0700414 A request object that you can call &#x27;execute()&#x27; on to request the next
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700415 page. Returns None if there are no more items in the collection.
416 </pre>
417</div>
418
419<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700420 <code class="details" id="update">update(projectId, datasetId, routineId, body=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700421 <pre>Updates information in an existing routine. The update method replaces the entire Routine resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700422
423Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700424 projectId: string, Required. Project ID of the routine to update (required)
425 datasetId: string, Required. Dataset ID of the routine to update (required)
426 routineId: string, Required. Routine ID of the routine to update (required)
427 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700428 The object takes the form of:
429
430{ # A user-defined function or a stored procedure.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800431 &quot;arguments&quot;: [ # Optional.
432 { # Input/output argument of a function or a stored procedure.
433 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
434 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800435 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
436 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
437 &quot;fields&quot;: [
438 # Object with schema name: StandardSqlField
439 ],
440 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800441 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800442 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800443 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
444 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
445 },
446 ],
447 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
448 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
449 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
450 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
451 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
452 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
453 &quot;A String&quot;,
454 ],
455 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
456 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700457 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
458 &quot;columns&quot;: [ # The columns in this table type
459 { # A field or a column.
460 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
461 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
462 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
463 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
464 &quot;fields&quot;: [
465 # Object with schema name: StandardSqlField
466 ],
467 },
468 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
469 },
470 },
471 ],
472 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800473 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
474 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
475 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
476 &quot;fields&quot;: [
477 # Object with schema name: StandardSqlField
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800478 ],
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800479 },
480 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
481 },
482 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
483 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
484 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
485 &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.
486 },
487 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
488}
489
490
491Returns:
492 An object of the form:
493
494 { # A user-defined function or a stored procedure.
495 &quot;arguments&quot;: [ # Optional.
496 { # Input/output argument of a function or a stored procedure.
497 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
498 &quot;dataType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Required unless argument_kind = ANY_TYPE.
499 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
500 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
501 &quot;fields&quot;: [
502 # Object with schema name: StandardSqlField
503 ],
504 },
505 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
Yoshi Automation Botb6971b02020-11-26 17:16:03 -0800506 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800507 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
508 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
509 },
510 ],
511 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
512 &quot;definitionBody&quot;: &quot;A String&quot;, # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, &quot;\n&quot;, y))` The definition_body is `concat(x, &quot;\n&quot;, y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS &#x27;return &quot;\n&quot;;\n&#x27;` The definition_body is `return &quot;\n&quot;;\n` Note that both \n are replaced with linebreaks.
513 &quot;description&quot;: &quot;A String&quot;, # Optional. [Experimental] The description of the routine if defined.
514 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. [Experimental] The determinism level of the JavaScript UDF if defined.
515 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
516 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
517 &quot;A String&quot;,
518 ],
519 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
520 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700521 &quot;returnTableType&quot;: { # A table type # Optional. Set only if Routine is a &quot;TABLE_VALUED_FUNCTION&quot;. TODO(b/173344646) - Update return_type documentation to say it cannot be set for TABLE_VALUED_FUNCTION before preview launch.
522 &quot;columns&quot;: [ # The columns in this table type
523 { # A field or a column.
524 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
525 &quot;type&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this &quot;type&quot; field).
526 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
527 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
528 &quot;fields&quot;: [
529 # Object with schema name: StandardSqlField
530 ],
531 },
532 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
533 },
534 },
535 ],
536 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800537 &quot;returnType&quot;: { # The type of a variable, e.g., a function argument. Examples: INT64: {type_kind=&quot;INT64&quot;} ARRAY: {type_kind=&quot;ARRAY&quot;, array_element_type=&quot;STRING&quot;} STRUCT&gt;: {type_kind=&quot;STRUCT&quot;, struct_type={fields=[ {name=&quot;x&quot;, type={type_kind=&quot;STRING&quot;}}, {name=&quot;y&quot;, type={type_kind=&quot;ARRAY&quot;, array_element_type=&quot;DATE&quot;}} ]}} # Optional if language = &quot;SQL&quot;; required otherwise. If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: &quot;FLOAT64&quot;}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
538 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
539 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
540 &quot;fields&quot;: [
541 # Object with schema name: StandardSqlField
542 ],
543 },
544 &quot;typeKind&quot;: &quot;A String&quot;, # Required. The top level type of this field. Can be any standard SQL data type (e.g., &quot;INT64&quot;, &quot;DATE&quot;, &quot;ARRAY&quot;).
545 },
546 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
547 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
548 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
549 &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.
550 },
551 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
552}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700553</div>
554
555</body></html>