blob: 15b4f5bf0f5e674a10626a5a8f858ffc7661ca4e [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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700147 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
148 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800149 &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-bot96afc042021-08-24 00:22:31 -0700155 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700156 &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-code-bot96afc042021-08-24 00:22:31 -0700171 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800172 &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.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700186 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800187}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700188</div>
189
190<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700191 <code class="details" id="insert">insert(projectId, datasetId, body=None)</code>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700192 <pre>Creates a new routine in the dataset.
193
194Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700195 projectId: string, Required. Project ID of the new routine (required)
196 datasetId: string, Required. Dataset ID of the new routine (required)
197 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700198 The object takes the form of:
199
200{ # A user-defined function or a stored procedure.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800201 &quot;arguments&quot;: [ # Optional.
202 { # Input/output argument of a function or a stored procedure.
203 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
204 &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 -0800205 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
206 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
207 &quot;fields&quot;: [
208 # Object with schema name: StandardSqlField
209 ],
210 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800211 &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 -0800212 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800213 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
214 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
215 },
216 ],
217 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
218 &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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700219 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
220 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800221 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
222 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
223 &quot;A String&quot;,
224 ],
225 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
226 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700227 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700228 &quot;columns&quot;: [ # The columns in this table type
229 { # A field or a column.
230 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
231 &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).
232 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
233 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
234 &quot;fields&quot;: [
235 # Object with schema name: StandardSqlField
236 ],
237 },
238 &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;).
239 },
240 },
241 ],
242 },
yoshi-code-bot96afc042021-08-24 00:22:31 -0700243 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800244 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
245 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
246 &quot;fields&quot;: [
247 # Object with schema name: StandardSqlField
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800248 ],
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800249 },
250 &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;).
251 },
252 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
253 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
254 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
255 &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.
256 },
257 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700258 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800259}
260
261
262Returns:
263 An object of the form:
264
265 { # A user-defined function or a stored procedure.
266 &quot;arguments&quot;: [ # Optional.
267 { # Input/output argument of a function or a stored procedure.
268 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
269 &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.
270 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
271 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
272 &quot;fields&quot;: [
273 # Object with schema name: StandardSqlField
274 ],
275 },
276 &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 -0800277 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800278 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
279 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
280 },
281 ],
282 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
283 &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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700284 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
285 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800286 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
287 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
288 &quot;A String&quot;,
289 ],
290 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
291 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700292 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700293 &quot;columns&quot;: [ # The columns in this table type
294 { # A field or a column.
295 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
296 &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).
297 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
298 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
299 &quot;fields&quot;: [
300 # Object with schema name: StandardSqlField
301 ],
302 },
303 &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;).
304 },
305 },
306 ],
307 },
yoshi-code-bot96afc042021-08-24 00:22:31 -0700308 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800309 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
310 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
311 &quot;fields&quot;: [
312 # Object with schema name: StandardSqlField
313 ],
314 },
315 &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;).
316 },
317 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
318 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
319 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
320 &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.
321 },
322 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700323 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800324}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700325</div>
326
327<div class="method">
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800328 <code class="details" id="list">list(projectId, datasetId, filter=None, maxResults=None, pageToken=None, readMask=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700329 <pre>Lists all routines in the specified dataset. Requires the READER dataset role.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700330
331Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700332 projectId: string, Required. Project ID of the routines to list (required)
333 datasetId: string, Required. Dataset ID of the routines to list (required)
Yoshi Automation Bot0bf565c2020-12-09 08:56:03 -0800334 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 -0800335 maxResults: integer, The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
336 pageToken: string, Page token, returned by a previous call, to request the next page of results
337 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 -0700338
339Returns:
340 An object of the form:
341
342 {
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800343 &quot;nextPageToken&quot;: &quot;A String&quot;, # A token to request the next page of results.
344 &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.
345 { # A user-defined function or a stored procedure.
346 &quot;arguments&quot;: [ # Optional.
347 { # Input/output argument of a function or a stored procedure.
348 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
349 &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 -0800350 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
351 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
352 &quot;fields&quot;: [
353 # Object with schema name: StandardSqlField
354 ],
355 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800356 &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 -0800357 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800358 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
359 &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 -0800360 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800361 ],
362 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
363 &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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700364 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
365 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800366 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
367 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
368 &quot;A String&quot;,
369 ],
370 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
371 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700372 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700373 &quot;columns&quot;: [ # The columns in this table type
374 { # A field or a column.
375 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
376 &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).
377 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
378 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
379 &quot;fields&quot;: [
380 # Object with schema name: StandardSqlField
381 ],
382 },
383 &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;).
384 },
385 },
386 ],
387 },
yoshi-code-bot96afc042021-08-24 00:22:31 -0700388 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800389 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
390 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
391 &quot;fields&quot;: [
392 # Object with schema name: StandardSqlField
393 ],
394 },
395 &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;).
396 },
397 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
398 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
399 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
400 &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.
401 },
402 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700403 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800404 },
405 ],
406}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700407</div>
408
409<div class="method">
410 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
411 <pre>Retrieves the next page of results.
412
413Args:
414 previous_request: The request for the previous page. (required)
415 previous_response: The response from the request for the previous page. (required)
416
417Returns:
Bu Sun Kim65020912020-05-20 12:08:20 -0700418 A request object that you can call &#x27;execute()&#x27; on to request the next
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700419 page. Returns None if there are no more items in the collection.
420 </pre>
421</div>
422
423<div class="method">
Dan O'Mearadd494642020-05-01 07:42:23 -0700424 <code class="details" id="update">update(projectId, datasetId, routineId, body=None)</code>
Dmitry Frenkel3e17f892020-10-06 16:46:05 -0700425 <pre>Updates information in an existing routine. The update method replaces the entire Routine resource.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700426
427Args:
Dan O'Mearadd494642020-05-01 07:42:23 -0700428 projectId: string, Required. Project ID of the routine to update (required)
429 datasetId: string, Required. Dataset ID of the routine to update (required)
430 routineId: string, Required. Routine ID of the routine to update (required)
431 body: object, The request body.
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700432 The object takes the form of:
433
434{ # A user-defined function or a stored procedure.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800435 &quot;arguments&quot;: [ # Optional.
436 { # Input/output argument of a function or a stored procedure.
437 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
438 &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 -0800439 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
440 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
441 &quot;fields&quot;: [
442 # Object with schema name: StandardSqlField
443 ],
444 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800445 &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 -0800446 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800447 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
448 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
449 },
450 ],
451 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
452 &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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700453 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
454 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800455 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
456 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
457 &quot;A String&quot;,
458 ],
459 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
460 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700461 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700462 &quot;columns&quot;: [ # The columns in this table type
463 { # A field or a column.
464 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
465 &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).
466 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
467 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
468 &quot;fields&quot;: [
469 # Object with schema name: StandardSqlField
470 ],
471 },
472 &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;).
473 },
474 },
475 ],
476 },
yoshi-code-bot96afc042021-08-24 00:22:31 -0700477 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800478 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
479 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
480 &quot;fields&quot;: [
481 # Object with schema name: StandardSqlField
Yoshi Automation Botc2228be2020-11-24 15:48:03 -0800482 ],
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800483 },
484 &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;).
485 },
486 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
487 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
488 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
489 &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.
490 },
491 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700492 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800493}
494
495
496Returns:
497 An object of the form:
498
499 { # A user-defined function or a stored procedure.
500 &quot;arguments&quot;: [ # Optional.
501 { # Input/output argument of a function or a stored procedure.
502 &quot;argumentKind&quot;: &quot;A String&quot;, # Optional. Defaults to FIXED_TYPE.
503 &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.
504 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
505 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
506 &quot;fields&quot;: [
507 # Object with schema name: StandardSqlField
508 ],
509 },
510 &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 -0800511 },
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800512 &quot;mode&quot;: &quot;A String&quot;, # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
513 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this argument. Can be absent for function return argument.
514 },
515 ],
516 &quot;creationTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was created, in milliseconds since the epoch.
517 &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.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700518 &quot;description&quot;: &quot;A String&quot;, # Optional. The description of the routine, if defined.
519 &quot;determinismLevel&quot;: &quot;A String&quot;, # Optional. The determinism level of the JavaScript UDF, if defined.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800520 &quot;etag&quot;: &quot;A String&quot;, # Output only. A hash of this resource.
521 &quot;importedLibraries&quot;: [ # Optional. If language = &quot;JAVASCRIPT&quot;, this field stores the path of the imported JAVASCRIPT libraries.
522 &quot;A String&quot;,
523 ],
524 &quot;language&quot;: &quot;A String&quot;, # Optional. Defaults to &quot;SQL&quot;.
525 &quot;lastModifiedTime&quot;: &quot;A String&quot;, # Output only. The time when this routine was last modified, in milliseconds since the epoch.
yoshi-code-bot96afc042021-08-24 00:22:31 -0700526 &quot;returnTableType&quot;: { # A table type # Optional. Can be set only if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
yoshi-code-bota8b35b92021-03-31 13:33:30 -0700527 &quot;columns&quot;: [ # The columns in this table type
528 { # A field or a column.
529 &quot;name&quot;: &quot;A String&quot;, # Optional. The name of this field. Can be absent for struct fields.
530 &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).
531 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
532 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
533 &quot;fields&quot;: [
534 # Object with schema name: StandardSqlField
535 ],
536 },
537 &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;).
538 },
539 },
540 ],
541 },
yoshi-code-bot96afc042021-08-24 00:22:31 -0700542 &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. Cannot be set if routine_type = &quot;TABLE_VALUED_FUNCTION&quot;. 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.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800543 &quot;arrayElementType&quot;: # Object with schema name: StandardSqlDataType # The type of the array&#x27;s elements, if type_kind = &quot;ARRAY&quot;.
544 &quot;structType&quot;: { # The fields of this struct, in order, if type_kind = &quot;STRUCT&quot;.
545 &quot;fields&quot;: [
546 # Object with schema name: StandardSqlField
547 ],
548 },
549 &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;).
550 },
551 &quot;routineReference&quot;: { # Required. Reference describing the ID of this routine.
552 &quot;datasetId&quot;: &quot;A String&quot;, # [Required] The ID of the dataset containing this routine.
553 &quot;projectId&quot;: &quot;A String&quot;, # [Required] The ID of the project containing this routine.
554 &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.
555 },
556 &quot;routineType&quot;: &quot;A String&quot;, # Required. The type of routine.
yoshi-code-bot2da5ed12021-09-07 00:20:27 -0700557 &quot;strictMode&quot;: True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
Yoshi Automation Botcc94ec82021-01-15 07:10:04 -0800558}</pre>
Bu Sun Kim715bd7f2019-06-14 16:50:42 -0700559</div>
560
561</body></html>