v1

latestOpenAPI 3.0.0Creative Commons Attribution 3.02026-07-1342224376.9 KB
routines

Creates a new routine in the dataset. # IAM Permissions Requires the bigquery.routines.create permission on the dataset.

post/projects/{+projectId}/datasets/{+datasetId}/routines

Path parameters

projectIdstring required

Required. Project ID of the new routine

datasetIdstring required

Required. Dataset ID of the new routine

Request body

dataGovernanceType'DATA_GOVERNANCE_TYPE_UNSPECIFIED' | 'DATA_MASKING'

Optional. If set to DATA_MASKING, the function is validated and made available as a masking function. For more information, see Create custom masking routines.

securityMode'SECURITY_MODE_UNSPECIFIED' | 'DEFINER' | 'INVOKER'

Optional. The security mode of the routine, if defined. If not defined, the security mode is automatically determined from the routine's configuration.

strictModeboolean

Optional. Use this option to catch many common errors. Error checking is not exhaustive, and successfully creating a procedure doesn't guarantee that the procedure will successfully execute at runtime. If strictMode is set to TRUE, the procedure body is further checked for errors such as non-existent tables or columns. The CREATE PROCEDURE statement fails if the body fails any of these checks. If strictMode is set to FALSE, the procedure body is checked only for syntax. For procedures that invoke themselves recursively, specify strictMode=FALSE to avoid non-existent procedure errors during validation. Default value is TRUE.

determinismLevel'DETERMINISM_LEVEL_UNSPECIFIED' | 'DETERMINISTIC' | 'NOT_DETERMINISTIC'

Optional. The determinism level of the JavaScript UDF, if defined.

descriptionstring

Optional. The description of the routine, if defined.

language'LANGUAGE_UNSPECIFIED' | 'SQL' | 'JAVASCRIPT' | 'PYTHON' | 'JAVA' | 'SCALA'

Optional. Defaults to "SQL" if remote_function_options field is absent, not set otherwise.

etagstring

Output only. A hash of this resource.

definitionBodystring

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. If definition_body references another routine, then that routine must be fully qualified with its project ID.

lastModifiedTimestring int64

Output only. The time when this routine was last modified, in milliseconds since the epoch.

importedLibrariesstring[]

Optional. If language = "JAVASCRIPT", this field stores the path of the imported JAVASCRIPT libraries.

creationTimestring int64

Output only. The time when this routine was created, in milliseconds since the epoch.

routineType'ROUTINE_TYPE_UNSPECIFIED' | 'SCALAR_FUNCTION' | 'PROCEDURE' | 'TABLE_VALUED_FUNCTION' | 'AGGREGATE_FUNCTION'

Required. The type of routine.

Response

Successful response