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