Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, 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 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3 { |
| 50 | border-bottom: solid #CCC 1px; |
| 51 | } |
| 52 | |
| 53 | .toc_element { |
| 54 | margin-top: 0.5em; |
| 55 | } |
| 56 | |
| 57 | .firstline { |
| 58 | margin-left: 2 em; |
| 59 | } |
| 60 | |
| 61 | .method { |
| 62 | margin-top: 1em; |
| 63 | border: solid 1px #CCC; |
| 64 | padding: 1em; |
| 65 | background: #EEE; |
| 66 | } |
| 67 | |
| 68 | .details { |
| 69 | font-weight: bold; |
| 70 | font-size: 14px; |
| 71 | } |
| 72 | |
| 73 | </style> |
| 74 | |
| 75 | <h1><a href="bigquery_v2.html">BigQuery API</a> . <a href="bigquery_v2.routines.html">routines</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="#delete">delete(projectId, datasetId, routineId)</a></code></p> |
| 79 | <p class="firstline">Deletes the routine specified by routineId from the dataset.</p> |
| 80 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 81 | <code><a href="#get">get(projectId, datasetId, routineId, readMask=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 82 | <p class="firstline">Gets the specified routine resource by routine ID.</p> |
| 83 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 84 | <code><a href="#insert">insert(projectId, datasetId, body=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 85 | <p class="firstline">Creates a new routine in the dataset.</p> |
| 86 | <p class="toc_element"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 87 | <code><a href="#list">list(projectId, datasetId, readMask=None, filter=None, pageToken=None, maxResults=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 88 | <p class="firstline">Lists all routines in the specified dataset. Requires the READER dataset</p> |
| 89 | <p class="toc_element"> |
| 90 | <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> |
| 91 | <p class="firstline">Retrieves the next page of results.</p> |
| 92 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 93 | <code><a href="#update">update(projectId, datasetId, routineId, body=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 94 | <p class="firstline">Updates information in an existing routine. The update method replaces the</p> |
| 95 | <h3>Method Details</h3> |
| 96 | <div class="method"> |
| 97 | <code class="details" id="delete">delete(projectId, datasetId, routineId)</code> |
| 98 | <pre>Deletes the routine specified by routineId from the dataset. |
| 99 | |
| 100 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 101 | projectId: string, Required. Project ID of the routine to delete (required) |
| 102 | datasetId: string, Required. Dataset ID of the routine to delete (required) |
| 103 | routineId: string, Required. Routine ID of the routine to delete (required) |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 104 | </pre> |
| 105 | </div> |
| 106 | |
| 107 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 108 | <code class="details" id="get">get(projectId, datasetId, routineId, readMask=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 109 | <pre>Gets the specified routine resource by routine ID. |
| 110 | |
| 111 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 112 | projectId: string, Required. Project ID of the requested routine (required) |
| 113 | datasetId: string, Required. Dataset ID of the requested routine (required) |
| 114 | routineId: string, Required. Routine ID of the requested routine (required) |
| 115 | readMask: string, If set, only the Routine fields in the field mask are returned in the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 116 | response. If unset, all Routine fields are returned. |
| 117 | |
| 118 | Returns: |
| 119 | An object of the form: |
| 120 | |
| 121 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 122 | "definitionBody": "A String", # Required. The body of the routine. |
| 123 | # |
| 124 | # For functions, this is the expression in the AS clause. |
| 125 | # |
| 126 | # If language=SQL, it is the substring inside (but excluding) the |
| 127 | # parentheses. For example, for the function created with the following |
| 128 | # statement: |
| 129 | # |
| 130 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 131 | # |
| 132 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 133 | # linebreak). |
| 134 | # |
| 135 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 136 | # For example, for the function created with the following statement: |
| 137 | # |
| 138 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 139 | # |
| 140 | # The definition_body is |
| 141 | # |
| 142 | # `return "\n";\n` |
| 143 | # |
| 144 | # Note that both \n are replaced with linebreaks. |
| 145 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 146 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 147 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 148 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 149 | }, |
| 150 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 151 | "language": "A String", # Optional. Defaults to "SQL". |
| 152 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 153 | "etag": "A String", # Output only. A hash of this resource. |
| 154 | "routineType": "A String", # Required. The type of routine. |
| 155 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 156 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 157 | "arguments": [ # Optional. |
| 158 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 159 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 160 | # Examples: |
| 161 | # INT64: {type_kind="INT64"} |
| 162 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 163 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 164 | # {type_kind="STRUCT", |
| 165 | # struct_type={fields=[ |
| 166 | # {name="x", type={type_kind="STRING"}}, |
| 167 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 168 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 169 | "typeKind": "A String", # Required. The top level type of this field. |
| 170 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 171 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 172 | "fields": [ |
| 173 | # Object with schema name: StandardSqlField |
| 174 | ], |
| 175 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 176 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 177 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 178 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 179 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 180 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 181 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 182 | }, |
| 183 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 184 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 185 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 186 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 187 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 188 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 189 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 190 | # If absent, the return type is inferred from definition_body at query time |
| 191 | # in each query that references this routine. If present, then the evaluated |
| 192 | # result will be cast to the specified returned type at query time. |
| 193 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 194 | # For example, for the functions created with the following statements: |
| 195 | # |
| 196 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 197 | # |
| 198 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 199 | # |
| 200 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 201 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 202 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 203 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 204 | # |
| 205 | # Suppose the function `Add` is replaced by |
| 206 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 207 | # |
| 208 | # Then the inferred return type of `Increment` is automatically changed to |
| 209 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 210 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 211 | # INT64: {type_kind="INT64"} |
| 212 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 213 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 214 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 215 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 216 | # {name="x", type={type_kind="STRING"}}, |
| 217 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 218 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 219 | "typeKind": "A String", # Required. The top level type of this field. |
| 220 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 221 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 222 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 223 | # Object with schema name: StandardSqlField |
| 224 | ], |
| 225 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 226 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 227 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 228 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 229 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 230 | }</pre> |
| 231 | </div> |
| 232 | |
| 233 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 234 | <code class="details" id="insert">insert(projectId, datasetId, body=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 235 | <pre>Creates a new routine in the dataset. |
| 236 | |
| 237 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 238 | projectId: string, Required. Project ID of the new routine (required) |
| 239 | datasetId: string, Required. Dataset ID of the new routine (required) |
| 240 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 241 | The object takes the form of: |
| 242 | |
| 243 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 244 | "definitionBody": "A String", # Required. The body of the routine. |
| 245 | # |
| 246 | # For functions, this is the expression in the AS clause. |
| 247 | # |
| 248 | # If language=SQL, it is the substring inside (but excluding) the |
| 249 | # parentheses. For example, for the function created with the following |
| 250 | # statement: |
| 251 | # |
| 252 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 253 | # |
| 254 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 255 | # linebreak). |
| 256 | # |
| 257 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 258 | # For example, for the function created with the following statement: |
| 259 | # |
| 260 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 261 | # |
| 262 | # The definition_body is |
| 263 | # |
| 264 | # `return "\n";\n` |
| 265 | # |
| 266 | # Note that both \n are replaced with linebreaks. |
| 267 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 268 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 269 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 270 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 271 | }, |
| 272 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 273 | "language": "A String", # Optional. Defaults to "SQL". |
| 274 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 275 | "etag": "A String", # Output only. A hash of this resource. |
| 276 | "routineType": "A String", # Required. The type of routine. |
| 277 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 278 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 279 | "arguments": [ # Optional. |
| 280 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 281 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 282 | # Examples: |
| 283 | # INT64: {type_kind="INT64"} |
| 284 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 285 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 286 | # {type_kind="STRUCT", |
| 287 | # struct_type={fields=[ |
| 288 | # {name="x", type={type_kind="STRING"}}, |
| 289 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 290 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 291 | "typeKind": "A String", # Required. The top level type of this field. |
| 292 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 293 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 294 | "fields": [ |
| 295 | # Object with schema name: StandardSqlField |
| 296 | ], |
| 297 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 298 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 299 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 300 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 301 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 302 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 303 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 304 | }, |
| 305 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 306 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 307 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 308 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 309 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 310 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 311 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 312 | # If absent, the return type is inferred from definition_body at query time |
| 313 | # in each query that references this routine. If present, then the evaluated |
| 314 | # result will be cast to the specified returned type at query time. |
| 315 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 316 | # For example, for the functions created with the following statements: |
| 317 | # |
| 318 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 319 | # |
| 320 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 321 | # |
| 322 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 323 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 324 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 325 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 326 | # |
| 327 | # Suppose the function `Add` is replaced by |
| 328 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 329 | # |
| 330 | # Then the inferred return type of `Increment` is automatically changed to |
| 331 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 332 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 333 | # INT64: {type_kind="INT64"} |
| 334 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 335 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 336 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 337 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 338 | # {name="x", type={type_kind="STRING"}}, |
| 339 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 340 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 341 | "typeKind": "A String", # Required. The top level type of this field. |
| 342 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 343 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 344 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 345 | # Object with schema name: StandardSqlField |
| 346 | ], |
| 347 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 348 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 349 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 350 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 351 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | |
| 355 | Returns: |
| 356 | An object of the form: |
| 357 | |
| 358 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 359 | "definitionBody": "A String", # Required. The body of the routine. |
| 360 | # |
| 361 | # For functions, this is the expression in the AS clause. |
| 362 | # |
| 363 | # If language=SQL, it is the substring inside (but excluding) the |
| 364 | # parentheses. For example, for the function created with the following |
| 365 | # statement: |
| 366 | # |
| 367 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 368 | # |
| 369 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 370 | # linebreak). |
| 371 | # |
| 372 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 373 | # For example, for the function created with the following statement: |
| 374 | # |
| 375 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 376 | # |
| 377 | # The definition_body is |
| 378 | # |
| 379 | # `return "\n";\n` |
| 380 | # |
| 381 | # Note that both \n are replaced with linebreaks. |
| 382 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 383 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 384 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 385 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 386 | }, |
| 387 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 388 | "language": "A String", # Optional. Defaults to "SQL". |
| 389 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 390 | "etag": "A String", # Output only. A hash of this resource. |
| 391 | "routineType": "A String", # Required. The type of routine. |
| 392 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 393 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 394 | "arguments": [ # Optional. |
| 395 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 396 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 397 | # Examples: |
| 398 | # INT64: {type_kind="INT64"} |
| 399 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 400 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 401 | # {type_kind="STRUCT", |
| 402 | # struct_type={fields=[ |
| 403 | # {name="x", type={type_kind="STRING"}}, |
| 404 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 405 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 406 | "typeKind": "A String", # Required. The top level type of this field. |
| 407 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 408 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 409 | "fields": [ |
| 410 | # Object with schema name: StandardSqlField |
| 411 | ], |
| 412 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 413 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 414 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 415 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 416 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 417 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 418 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 419 | }, |
| 420 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 421 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 422 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 423 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 424 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 425 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 426 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 427 | # If absent, the return type is inferred from definition_body at query time |
| 428 | # in each query that references this routine. If present, then the evaluated |
| 429 | # result will be cast to the specified returned type at query time. |
| 430 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 431 | # For example, for the functions created with the following statements: |
| 432 | # |
| 433 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 434 | # |
| 435 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 436 | # |
| 437 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 438 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 439 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 440 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 441 | # |
| 442 | # Suppose the function `Add` is replaced by |
| 443 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 444 | # |
| 445 | # Then the inferred return type of `Increment` is automatically changed to |
| 446 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 447 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 448 | # INT64: {type_kind="INT64"} |
| 449 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 450 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 451 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 452 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 453 | # {name="x", type={type_kind="STRING"}}, |
| 454 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 455 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 456 | "typeKind": "A String", # Required. The top level type of this field. |
| 457 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 458 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 459 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 460 | # Object with schema name: StandardSqlField |
| 461 | ], |
| 462 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 463 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 464 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 465 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 466 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 467 | }</pre> |
| 468 | </div> |
| 469 | |
| 470 | <div class="method"> |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 471 | <code class="details" id="list">list(projectId, datasetId, readMask=None, filter=None, pageToken=None, maxResults=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 472 | <pre>Lists all routines in the specified dataset. Requires the READER dataset |
| 473 | role. |
| 474 | |
| 475 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 476 | projectId: string, Required. Project ID of the routines to list (required) |
| 477 | datasetId: string, Required. Dataset ID of the routines to list (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 478 | readMask: string, If set, then only the Routine fields in the field mask, as well as |
| 479 | project_id, dataset_id and routine_id, are returned in the response. |
| 480 | If unset, then the following Routine fields are returned: |
| 481 | etag, project_id, dataset_id, routine_id, routine_type, creation_time, |
| 482 | last_modified_time, and language. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 483 | filter: string, If set, then only the Routines matching this filter are returned. |
| 484 | The current supported form is either "routine_type:<RoutineType>" or |
| 485 | "routineType:<RoutineType>", where <RoutineType> is a RoutineType enum. |
| 486 | Example: "routineType:SCALAR_FUNCTION". |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 487 | pageToken: string, Page token, returned by a previous call, to request the next page of |
| 488 | results |
| 489 | maxResults: integer, The maximum number of results to return in a single response page. |
| 490 | Leverage the page tokens to iterate through the entire collection. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 491 | |
| 492 | Returns: |
| 493 | An object of the form: |
| 494 | |
| 495 | { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 496 | "routines": [ # Routines in the requested dataset. Unless read_mask is set in the request, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 497 | # only the following fields are populated: |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 498 | # etag, project_id, dataset_id, routine_id, routine_type, creation_time, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 499 | # last_modified_time, and language. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 500 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 501 | "definitionBody": "A String", # Required. The body of the routine. |
| 502 | # |
| 503 | # For functions, this is the expression in the AS clause. |
| 504 | # |
| 505 | # If language=SQL, it is the substring inside (but excluding) the |
| 506 | # parentheses. For example, for the function created with the following |
| 507 | # statement: |
| 508 | # |
| 509 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 510 | # |
| 511 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 512 | # linebreak). |
| 513 | # |
| 514 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 515 | # For example, for the function created with the following statement: |
| 516 | # |
| 517 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 518 | # |
| 519 | # The definition_body is |
| 520 | # |
| 521 | # `return "\n";\n` |
| 522 | # |
| 523 | # Note that both \n are replaced with linebreaks. |
| 524 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 525 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 526 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 527 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 528 | }, |
| 529 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 530 | "language": "A String", # Optional. Defaults to "SQL". |
| 531 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 532 | "etag": "A String", # Output only. A hash of this resource. |
| 533 | "routineType": "A String", # Required. The type of routine. |
| 534 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 535 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 536 | "arguments": [ # Optional. |
| 537 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 538 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 539 | # Examples: |
| 540 | # INT64: {type_kind="INT64"} |
| 541 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 542 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 543 | # {type_kind="STRUCT", |
| 544 | # struct_type={fields=[ |
| 545 | # {name="x", type={type_kind="STRING"}}, |
| 546 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 547 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 548 | "typeKind": "A String", # Required. The top level type of this field. |
| 549 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 550 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 551 | "fields": [ |
| 552 | # Object with schema name: StandardSqlField |
| 553 | ], |
| 554 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 555 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 556 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 557 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 558 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 559 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 560 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 561 | }, |
| 562 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 563 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 564 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 565 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 566 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 567 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 568 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 569 | # If absent, the return type is inferred from definition_body at query time |
| 570 | # in each query that references this routine. If present, then the evaluated |
| 571 | # result will be cast to the specified returned type at query time. |
| 572 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 573 | # For example, for the functions created with the following statements: |
| 574 | # |
| 575 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 576 | # |
| 577 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 578 | # |
| 579 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 580 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 581 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 582 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 583 | # |
| 584 | # Suppose the function `Add` is replaced by |
| 585 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 586 | # |
| 587 | # Then the inferred return type of `Increment` is automatically changed to |
| 588 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 589 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 590 | # INT64: {type_kind="INT64"} |
| 591 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 592 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 593 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 594 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 595 | # {name="x", type={type_kind="STRING"}}, |
| 596 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 597 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 598 | "typeKind": "A String", # Required. The top level type of this field. |
| 599 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 600 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 601 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 602 | # Object with schema name: StandardSqlField |
| 603 | ], |
| 604 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 605 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 606 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 607 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 608 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 609 | }, |
| 610 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 611 | "nextPageToken": "A String", # A token to request the next page of results. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 612 | }</pre> |
| 613 | </div> |
| 614 | |
| 615 | <div class="method"> |
| 616 | <code class="details" id="list_next">list_next(previous_request, previous_response)</code> |
| 617 | <pre>Retrieves the next page of results. |
| 618 | |
| 619 | Args: |
| 620 | previous_request: The request for the previous page. (required) |
| 621 | previous_response: The response from the request for the previous page. (required) |
| 622 | |
| 623 | Returns: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 624 | A request object that you can call 'execute()' on to request the next |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 625 | page. Returns None if there are no more items in the collection. |
| 626 | </pre> |
| 627 | </div> |
| 628 | |
| 629 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 630 | <code class="details" id="update">update(projectId, datasetId, routineId, body=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 631 | <pre>Updates information in an existing routine. The update method replaces the |
| 632 | entire Routine resource. |
| 633 | |
| 634 | Args: |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 635 | projectId: string, Required. Project ID of the routine to update (required) |
| 636 | datasetId: string, Required. Dataset ID of the routine to update (required) |
| 637 | routineId: string, Required. Routine ID of the routine to update (required) |
| 638 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 639 | The object takes the form of: |
| 640 | |
| 641 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 642 | "definitionBody": "A String", # Required. The body of the routine. |
| 643 | # |
| 644 | # For functions, this is the expression in the AS clause. |
| 645 | # |
| 646 | # If language=SQL, it is the substring inside (but excluding) the |
| 647 | # parentheses. For example, for the function created with the following |
| 648 | # statement: |
| 649 | # |
| 650 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 651 | # |
| 652 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 653 | # linebreak). |
| 654 | # |
| 655 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 656 | # For example, for the function created with the following statement: |
| 657 | # |
| 658 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 659 | # |
| 660 | # The definition_body is |
| 661 | # |
| 662 | # `return "\n";\n` |
| 663 | # |
| 664 | # Note that both \n are replaced with linebreaks. |
| 665 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 666 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 667 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 668 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 669 | }, |
| 670 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 671 | "language": "A String", # Optional. Defaults to "SQL". |
| 672 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 673 | "etag": "A String", # Output only. A hash of this resource. |
| 674 | "routineType": "A String", # Required. The type of routine. |
| 675 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 676 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 677 | "arguments": [ # Optional. |
| 678 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 679 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 680 | # Examples: |
| 681 | # INT64: {type_kind="INT64"} |
| 682 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 683 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 684 | # {type_kind="STRUCT", |
| 685 | # struct_type={fields=[ |
| 686 | # {name="x", type={type_kind="STRING"}}, |
| 687 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 688 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 689 | "typeKind": "A String", # Required. The top level type of this field. |
| 690 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 691 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 692 | "fields": [ |
| 693 | # Object with schema name: StandardSqlField |
| 694 | ], |
| 695 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 696 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 697 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 698 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 699 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 700 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 701 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 702 | }, |
| 703 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 704 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 705 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 706 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 707 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 708 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 709 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 710 | # If absent, the return type is inferred from definition_body at query time |
| 711 | # in each query that references this routine. If present, then the evaluated |
| 712 | # result will be cast to the specified returned type at query time. |
| 713 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 714 | # For example, for the functions created with the following statements: |
| 715 | # |
| 716 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 717 | # |
| 718 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 719 | # |
| 720 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 721 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 722 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 723 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 724 | # |
| 725 | # Suppose the function `Add` is replaced by |
| 726 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 727 | # |
| 728 | # Then the inferred return type of `Increment` is automatically changed to |
| 729 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 730 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 731 | # INT64: {type_kind="INT64"} |
| 732 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 733 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 734 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 735 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 736 | # {name="x", type={type_kind="STRING"}}, |
| 737 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 738 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 739 | "typeKind": "A String", # Required. The top level type of this field. |
| 740 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 741 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 742 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 743 | # Object with schema name: StandardSqlField |
| 744 | ], |
| 745 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 746 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 747 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 748 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 749 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 750 | } |
| 751 | |
| 752 | |
| 753 | Returns: |
| 754 | An object of the form: |
| 755 | |
| 756 | { # A user-defined function or a stored procedure. |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 757 | "definitionBody": "A String", # Required. The body of the routine. |
| 758 | # |
| 759 | # For functions, this is the expression in the AS clause. |
| 760 | # |
| 761 | # If language=SQL, it is the substring inside (but excluding) the |
| 762 | # parentheses. For example, for the function created with the following |
| 763 | # statement: |
| 764 | # |
| 765 | # `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` |
| 766 | # |
| 767 | # The definition_body is `concat(x, "\n", y)` (\n is not replaced with |
| 768 | # linebreak). |
| 769 | # |
| 770 | # If language=JAVASCRIPT, it is the evaluated string in the AS clause. |
| 771 | # For example, for the function created with the following statement: |
| 772 | # |
| 773 | # `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` |
| 774 | # |
| 775 | # The definition_body is |
| 776 | # |
| 777 | # `return "\n";\n` |
| 778 | # |
| 779 | # Note that both \n are replaced with linebreaks. |
| 780 | "routineReference": { # Required. Reference describing the ID of this routine. |
| 781 | "projectId": "A String", # [Required] The ID of the project containing this routine. |
| 782 | "datasetId": "A String", # [Required] The ID of the dataset containing this routine. |
| 783 | "routineId": "A String", # [Required] The ID of the routine. The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 256 characters. |
| 784 | }, |
| 785 | "determinismLevel": "A String", # Optional. [Experimental] The determinism level of the JavaScript UDF if defined. |
| 786 | "language": "A String", # Optional. Defaults to "SQL". |
| 787 | "description": "A String", # Optional. [Experimental] The description of the routine if defined. |
| 788 | "etag": "A String", # Output only. A hash of this resource. |
| 789 | "routineType": "A String", # Required. The type of routine. |
| 790 | "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since |
| 791 | # the epoch. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 792 | "arguments": [ # Optional. |
| 793 | { # Input/output argument of a function or a stored procedure. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 794 | "dataType": { # The type of a variable, e.g., a function argument. # Required unless argument_kind = ANY_TYPE. |
| 795 | # Examples: |
| 796 | # INT64: {type_kind="INT64"} |
| 797 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
| 798 | # STRUCT<x STRING, y ARRAY<DATE>>: |
| 799 | # {type_kind="STRUCT", |
| 800 | # struct_type={fields=[ |
| 801 | # {name="x", type={type_kind="STRING"}}, |
| 802 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
| 803 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 804 | "typeKind": "A String", # Required. The top level type of this field. |
| 805 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
| 806 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 807 | "fields": [ |
| 808 | # Object with schema name: StandardSqlField |
| 809 | ], |
| 810 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 811 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 812 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 813 | "name": "A String", # Optional. The name of this argument. Can be absent for function return argument. |
| 814 | "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE. |
| 815 | "mode": "A String", # Optional. Specifies whether the argument is input or output. |
| 816 | # Can be set for procedures only. |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 817 | }, |
| 818 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 819 | "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 820 | # imported JAVASCRIPT libraries. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 821 | "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 822 | ], |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 823 | "returnType": { # The type of a variable, e.g., a function argument. # Optional if language = "SQL"; required otherwise. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 824 | # |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 825 | # If absent, the return type is inferred from definition_body at query time |
| 826 | # in each query that references this routine. If present, then the evaluated |
| 827 | # result will be cast to the specified returned type at query time. |
| 828 | # |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 829 | # For example, for the functions created with the following statements: |
| 830 | # |
| 831 | # * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` |
| 832 | # |
| 833 | # * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` |
| 834 | # |
| 835 | # * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` |
| 836 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 837 | # The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 838 | # is absent for `Increment` (inferred as FLOAT64 at query time). |
| 839 | # |
| 840 | # Suppose the function `Add` is replaced by |
| 841 | # `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` |
| 842 | # |
| 843 | # Then the inferred return type of `Increment` is automatically changed to |
| 844 | # INT64 at query time, while the return type of `Decrement` remains FLOAT64. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 845 | # Examples: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 846 | # INT64: {type_kind="INT64"} |
| 847 | # ARRAY<STRING>: {type_kind="ARRAY", array_element_type="STRING"} |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 848 | # STRUCT<x STRING, y ARRAY<DATE>>: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 849 | # {type_kind="STRUCT", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 850 | # struct_type={fields=[ |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 851 | # {name="x", type={type_kind="STRING"}}, |
| 852 | # {name="y", type={type_kind="ARRAY", array_element_type="DATE"}} |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 853 | # ]}} |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 854 | "typeKind": "A String", # Required. The top level type of this field. |
| 855 | # Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY"). |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 856 | "structType": { # The fields of this struct, in order, if type_kind = "STRUCT". |
| 857 | "fields": [ |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 858 | # Object with schema name: StandardSqlField |
| 859 | ], |
| 860 | }, |
Bu Sun Kim | d059ad8 | 2020-07-22 17:02:09 -0700 | [diff] [blame^] | 861 | "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY". |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 862 | }, |
Bu Sun Kim | 4ed7d3f | 2020-05-27 12:20:54 -0700 | [diff] [blame] | 863 | "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds |
| 864 | # since the epoch. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 865 | }</pre> |
| 866 | </div> |
| 867 | |
| 868 | </body></html> |