# BigQuery API . routines

## Instance Methods

Close httplib2 connections.

Deletes the routine specified by routineId from the dataset.

Gets the specified routine resource by routine ID.

Creates a new routine in the dataset.

Lists all routines in the specified dataset. Requires the READER dataset role.

Retrieves the next page of results.

Updates information in an existing routine. The update method replaces the entire Routine resource.

### Method Details

`close()`

    Close httplib2 connections.

`delete(projectId, datasetId, routineId)`

    Deletes the routine specified by routineId from the dataset.

    Args:
      projectId: string, Required. Project ID of the routine to delete (required)
      datasetId: string, Required. Dataset ID of the routine to delete (required)
      routineId: string, Required. Routine ID of the routine to delete (required)

`get(projectId, datasetId, routineId, readMask=None)`

    Gets the specified routine resource by routine ID.

    Args:
      projectId: string, Required. Project ID of the requested routine (required)
      datasetId: string, Required. Dataset ID of the requested routine (required)
      routineId: string, Required. Routine ID of the requested routine (required)
      readMask: string, If set, only the Routine fields in the field mask are returned in the response. If unset, all Routine fields are returned.

    Returns:
      An object of the form:

        { # A user-defined function or a stored procedure.
      "arguments": [ # Optional.
        { # Input/output argument of a function or a stored procedure.
          "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
          "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
          "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
        },
      ],
      "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
      "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
      "description": "A String", # Optional. The description of the routine, if defined.
      "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
      "etag": "A String", # Output only. A hash of this resource.
      "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
        "A String",
      ],
      "language": "A String", # Optional. Defaults to "SQL".
      "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
      "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
        "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
        "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
        "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
        "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
          "a_key": "A String",
        },
      },
      "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
        "columns": [ # The columns in this table type
          { # A field or a column.
            "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
            "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
              "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
              "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                "fields": [
                  # Object with schema name: StandardSqlField
                ],
              },
              "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
            },
          },
        ],
      },
      "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
        "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
        "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
          "fields": [
            # Object with schema name: StandardSqlField
          ],
        },
        "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
      },
      "routineReference": { # Required. Reference describing the ID of this routine.
        "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
        "projectId": "A String", # [Required] The ID of the project containing this routine.
        "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.
      },
      "routineType": "A String", # Required. The type of routine.
      "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
        "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
        "containerImage": "A String", # Custom container image for the runtime environment.
        "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
        "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "a_key": "A String",
        },
        "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
      },
      "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
    }

`insert(projectId, datasetId, body=None)`

    Creates a new routine in the dataset.

    Args:
      projectId: string, Required. Project ID of the new routine (required)
      datasetId: string, Required. Dataset ID of the new routine (required)
      body: object, The request body.
        The object takes the form of:

    { # A user-defined function or a stored procedure.
      "arguments": [ # Optional.
        { # Input/output argument of a function or a stored procedure.
          "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
          "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
          "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
        },
      ],
      "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
      "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
      "description": "A String", # Optional. The description of the routine, if defined.
      "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
      "etag": "A String", # Output only. A hash of this resource.
      "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
        "A String",
      ],
      "language": "A String", # Optional. Defaults to "SQL".
      "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
      "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
        "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
        "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
        "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
        "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
          "a_key": "A String",
        },
      },
      "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
        "columns": [ # The columns in this table type
          { # A field or a column.
            "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
            "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
              "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
              "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                "fields": [
                  # Object with schema name: StandardSqlField
                ],
              },
              "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
            },
          },
        ],
      },
      "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
        "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
        "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
          "fields": [
            # Object with schema name: StandardSqlField
          ],
        },
        "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
      },
      "routineReference": { # Required. Reference describing the ID of this routine.
        "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
        "projectId": "A String", # [Required] The ID of the project containing this routine.
        "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.
      },
      "routineType": "A String", # Required. The type of routine.
      "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
        "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
        "containerImage": "A String", # Custom container image for the runtime environment.
        "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
        "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "a_key": "A String",
        },
        "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
      },
      "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
    }

    Returns:
      An object of the form:

        { # A user-defined function or a stored procedure.
      "arguments": [ # Optional.
        { # Input/output argument of a function or a stored procedure.
          "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
          "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
          "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
        },
      ],
      "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
      "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
      "description": "A String", # Optional. The description of the routine, if defined.
      "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
      "etag": "A String", # Output only. A hash of this resource.
      "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
        "A String",
      ],
      "language": "A String", # Optional. Defaults to "SQL".
      "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
      "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
        "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
        "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
        "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
        "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
          "a_key": "A String",
        },
      },
      "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
        "columns": [ # The columns in this table type
          { # A field or a column.
            "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
            "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
              "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
              "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                "fields": [
                  # Object with schema name: StandardSqlField
                ],
              },
              "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
            },
          },
        ],
      },
      "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
        "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
        "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
          "fields": [
            # Object with schema name: StandardSqlField
          ],
        },
        "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
      },
      "routineReference": { # Required. Reference describing the ID of this routine.
        "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
        "projectId": "A String", # [Required] The ID of the project containing this routine.
        "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.
      },
      "routineType": "A String", # Required. The type of routine.
      "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
        "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
        "containerImage": "A String", # Custom container image for the runtime environment.
        "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
        "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "a_key": "A String",
        },
        "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
      },
      "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
    }

`list(projectId, datasetId, filter=None, maxResults=None, pageToken=None, readMask=None)`

    Lists all routines in the specified dataset. Requires the READER dataset role.

    Args:
      projectId: string, Required. Project ID of the routines to list (required)
      datasetId: string, Required. Dataset ID of the routines to list (required)
      filter: string, If set, then only the Routines matching this filter are returned. The current supported form is either "routine_type:" or "routineType:", where is a RoutineType enum. Example: "routineType:SCALAR_FUNCTION".
      maxResults: integer, The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.
      pageToken: string, Page token, returned by a previous call, to request the next page of results
      readMask: string, If set, then only the Routine fields in the field mask, as well as project_id, dataset_id and routine_id, are returned in the response. If unset, then the following Routine fields are returned: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, and language.

    Returns:
      An object of the form:

        {
      "nextPageToken": "A String", # A token to request the next page of results.
      "routines": [ # Routines in the requested dataset. Unless read_mask is set in the request, only the following fields are populated: etag, project_id, dataset_id, routine_id, routine_type, creation_time, last_modified_time, and language.
        { # A user-defined function or a stored procedure.
          "arguments": [ # Optional.
            { # Input/output argument of a function or a stored procedure.
              "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
              "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
                "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
                "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                  "fields": [
                    # Object with schema name: StandardSqlField
                  ],
                },
                "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
              },
              "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
              "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
            },
          ],
          "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
          "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
          "description": "A String", # Optional. The description of the routine, if defined.
          "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
          "etag": "A String", # Output only. A hash of this resource.
          "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
            "A String",
          ],
          "language": "A String", # Optional. Defaults to "SQL".
          "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
          "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
            "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
            "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
            "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
            "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
              "a_key": "A String",
            },
          },
          "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
            "columns": [ # The columns in this table type
              { # A field or a column.
                "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
                "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
                  "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
                  "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                    "fields": [
                      # Object with schema name: StandardSqlField
                    ],
                  },
                  "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
                },
              },
            ],
          },
          "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "routineReference": { # Required. Reference describing the ID of this routine.
            "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
            "projectId": "A String", # [Required] The ID of the project containing this routine.
            "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.
          },
          "routineType": "A String", # Required. The type of routine.
          "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
            "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
              "A String",
            ],
            "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
            "containerImage": "A String", # Custom container image for the runtime environment.
            "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
              "A String",
            ],
            "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
              "A String",
            ],
            "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
            "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
              "a_key": "A String",
            },
            "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
              "A String",
            ],
            "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
          },
          "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
        },
      ],
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.

`update(projectId, datasetId, routineId, body=None)`

    Updates information in an existing routine. The update method replaces the entire Routine resource.

    Args:
      projectId: string, Required. Project ID of the routine to update (required)
      datasetId: string, Required. Dataset ID of the routine to update (required)
      routineId: string, Required. Routine ID of the routine to update (required)
      body: object, The request body.
        The object takes the form of:

    { # A user-defined function or a stored procedure.
      "arguments": [ # Optional.
        { # Input/output argument of a function or a stored procedure.
          "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
          "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
          "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
        },
      ],
      "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
      "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
      "description": "A String", # Optional. The description of the routine, if defined.
      "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
      "etag": "A String", # Output only. A hash of this resource.
      "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
        "A String",
      ],
      "language": "A String", # Optional. Defaults to "SQL".
      "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
      "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
        "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
        "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
        "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
        "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
          "a_key": "A String",
        },
      },
      "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
        "columns": [ # The columns in this table type
          { # A field or a column.
            "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
            "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
              "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
              "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                "fields": [
                  # Object with schema name: StandardSqlField
                ],
              },
              "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
            },
          },
        ],
      },
      "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
        "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
        "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
          "fields": [
            # Object with schema name: StandardSqlField
          ],
        },
        "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
      },
      "routineReference": { # Required. Reference describing the ID of this routine.
        "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
        "projectId": "A String", # [Required] The ID of the project containing this routine.
        "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.
      },
      "routineType": "A String", # Required. The type of routine.
      "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
        "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
        "containerImage": "A String", # Custom container image for the runtime environment.
        "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
        "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "a_key": "A String",
        },
        "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
      },
      "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
    }

    Returns:
      An object of the form:

        { # A user-defined function or a stored procedure.
      "arguments": [ # Optional.
        { # Input/output argument of a function or a stored procedure.
          "argumentKind": "A String", # Optional. Defaults to FIXED_TYPE.
          "dataType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Required unless argument_kind = ANY_TYPE.
            "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
            "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
              "fields": [
                # Object with schema name: StandardSqlField
              ],
            },
            "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
          },
          "mode": "A String", # Optional. Specifies whether the argument is input or output. Can be set for procedures only.
          "name": "A String", # Optional. The name of this argument. Can be absent for function return argument.
        },
      ],
      "creationTime": "A String", # Output only. The time when this routine was created, in milliseconds since the epoch.
      "definitionBody": "A String", # Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` The definition_body is `concat(x, "\n", y)` (\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` The definition_body is `return "\n";\n` Note that both \n are replaced with linebreaks.
      "description": "A String", # Optional. The description of the routine, if defined.
      "determinismLevel": "A String", # Optional. The determinism level of the JavaScript UDF, if defined.
      "etag": "A String", # Output only. A hash of this resource.
      "importedLibraries": [ # Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.
        "A String",
      ],
      "language": "A String", # Optional. Defaults to "SQL".
      "lastModifiedTime": "A String", # Output only. The time when this routine was last modified, in milliseconds since the epoch.
      "remoteFunctionOptions": { # Options for a remote user-defined function. # Optional. Remote function specific options.
        "connection": "A String", # Fully qualified name of the user-provided connection object which holds the authentication information to send requests to the remote service. Format: ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"```
        "endpoint": "A String", # Endpoint of the user-provided remote service, e.g. ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add```
        "maxBatchingRows": "A String", # Max number of rows in each batch sent to the remote service. If absent or if 0, BigQuery dynamically decides the number of rows in a batch.
        "userDefinedContext": { # User-defined context as a set of key/value pairs, which will be sent as function invocation context together with batched arguments in the requests to the remote service. The total number of bytes of keys and values must be less than 8KB.
          "a_key": "A String",
        },
      },
      "returnTableType": { # A table type # Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return table type is inferred from definition_body at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specificed in return table type, at query time.
        "columns": [ # The columns in this table type
          { # A field or a column.
            "name": "A String", # Optional. The name of this field. Can be absent for struct fields.
            "type": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional. The type of this parameter. Absent if not explicitly specified (e.g., CREATE FUNCTION statement can omit the return type; in this case the output parameter does not have this "type" field).
              "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
              "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
                "fields": [
                  # Object with schema name: StandardSqlField
                ],
              },
              "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
            },
          },
        ],
      },
      "returnType": { # The data type of a variable such as a function argument. Examples include: * INT64: `{"typeKind": "INT64"}` * ARRAY: { "typeKind": "ARRAY", "arrayElementType": {"typeKind": "STRING"} } * STRUCT>: { "typeKind": "STRUCT", "structType": { "fields": [ { "name": "x", "type": {"typeKind: "STRING"} }, { "name": "y", "type": { "typeKind": "ARRAY", "arrayElementType": {"typekind": "DATE"} } } ] } } # Optional if language = "SQL"; required otherwise. Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". If absent, the return type is inferred from definition_body at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time. For example, for the functions created with the following statements: * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and is absent for `Increment` (inferred as FLOAT64 at query time). Suppose the function `Add` is replaced by `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` Then the inferred return type of `Increment` is automatically changed to INT64 at query time, while the return type of `Decrement` remains FLOAT64.
        "arrayElementType": # Object with schema name: StandardSqlDataType # The type of the array's elements, if type_kind = "ARRAY".
        "structType": { # The fields of this struct, in order, if type_kind = "STRUCT".
          "fields": [
            # Object with schema name: StandardSqlField
          ],
        },
        "typeKind": "A String", # Required. The top level type of this field. Can be any standard SQL data type (e.g., "INT64", "DATE", "ARRAY").
      },
      "routineReference": { # Required. Reference describing the ID of this routine.
        "datasetId": "A String", # [Required] The ID of the dataset containing this routine.
        "projectId": "A String", # [Required] The ID of the project containing this routine.
        "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.
      },
      "routineType": "A String", # Required. The type of routine.
      "sparkOptions": { # Options for a user-defined Spark routine. # Optional. Spark specific options.
        "archiveUris": [ # Archive files to be extracted into the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "connection": "A String", # Fully qualified name of the user-provided Spark connection object. Format: ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"```
        "containerImage": "A String", # Custom container image for the runtime environment.
        "fileUris": [ # Files to be placed in the working directory of each executor. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "jarUris": [ # JARs to include on the driver and executor CLASSPATH. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "mainFileUri": "A String", # The main file URI of the Spark application. Exactly one of the definition_body field and the main_file_uri field must be set.
        "properties": { # Configuration properties as a set of key/value pairs, which will be passed on to the Spark application. For more information, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "a_key": "A String",
        },
        "pyFileUris": [ # Python files to be placed on the PYTHONPATH for PySpark application. Supported file types: `.py`, `.egg`, and `.zip`. For more information about Apache Spark, see [Apache Spark](https://spark.apache.org/docs/latest/index.html).
          "A String",
        ],
        "runtimeVersion": "A String", # Runtime version. If not specified, the default runtime version is used.
      },
      "strictMode": True or False, # Optional. Can be set for procedures only. If true (default), the definition body will be validated in the creation and the updates of the procedure. For procedures with an argument of ANY TYPE, the definition body validtion is not supported at creation/update time, and thus this field must be set to false explicitly.
    }