ROUTINES view
TheINFORMATION_SCHEMA.ROUTINES view contains one row for each routine in adataset.
Required permissions
To query theINFORMATION_SCHEMA.ROUTINES view, you need the followingIdentity and Access Management (IAM) permissions:
bigquery.routines.getbigquery.routines.list
Each of the following predefined IAM roles includes thepermissions that you need in order to get routine metadata:
roles/bigquery.adminroles/bigquery.metadataViewerroles/bigquery.dataViewer
For more information about BigQuery permissions, seeAccess control with IAM.
Schema
When you query theINFORMATION_SCHEMA.ROUTINES view, the query results containone row for each routine in a dataset.
TheINFORMATION_SCHEMA.ROUTINES view has the following schema:
| Column name | Data type | Value |
|---|---|---|
specific_catalog | STRING | The name of the project that contains the dataset where the routine is defined |
specific_schema | STRING | The name of the dataset that contains the routine |
specific_name | STRING | The name of the routine |
routine_catalog | STRING | The name of the project that contains the dataset where the routine is defined |
routine_schema | STRING | The name of the dataset that contains the routine |
routine_name | STRING | The name of the routine |
routine_type | STRING | The routine type:
|
data_type | STRING | The data type that the routine returns.NULL if the routine is a stored procedure |
routine_body | STRING | How the body of the routine is defined, eitherSQL orEXTERNAL if the routine is a JavaScript user-defined function |
routine_definition | STRING | The definition of the routine |
external_language | STRING | JAVASCRIPT if the routine is a JavaScript user-defined function orNULL if the routine was defined with SQL |
is_deterministic | STRING | YES if the routine is known to be deterministic,NO if it is not, orNULL if unknown |
security_type | STRING | Security type of the routine, alwaysNULL |
created | TIMESTAMP | The routine's creation time |
last_altered | TIMESTAMP | The routine's last modification time |
ddl | STRING | TheDDL statement that can be used to create the routine, such asCREATE FUNCTION orCREATE PROCEDURE |
connection | STRING | The connection name, if the routine has one. OtherwiseNULL |
For stability, we recommend that you explicitly list columns in your information schema queries instead ofusing a wildcard (SELECT *). Explicitly listing columns prevents queries frombreaking if the underlying schema changes.
Scope and syntax
Queries against this view must include a dataset or a region qualifier. For moreinformation seeSyntax.The following table explains the region and resource scopes for this view:
| View name | Resource scope | Region scope |
|---|---|---|
[PROJECT_ID.]`region-REGION`.INFORMATION_SCHEMA.ROUTINES | Project level | REGION |
[PROJECT_ID.]DATASET_ID.INFORMATION_SCHEMA.ROUTINES | Dataset level | Dataset location |
- Optional:
PROJECT_ID: the ID of your Google Cloud project. If not specified, the default project is used. REGION: anydataset region name. For example,`region-us`.DATASET_ID: the ID of your dataset. For more information, seeDataset qualifier.Note: You must usea region qualifier to query
INFORMATION_SCHEMAviews. The location of the query execution must match the region of theINFORMATION_SCHEMAview.
Example
-- Returns metadata for routines in a single dataset.SELECT*FROMmyDataset.INFORMATION_SCHEMA.ROUTINES;-- Returns metadata for routines in a region.SELECT*FROMregion-us.INFORMATION_SCHEMA.ROUTINES;Example
Example
To run the query against a project other than your default project, add theproject ID to the dataset in the following format:
`PROJECT_ID`.INFORMATION_SCHEMA.ROUTINES
`myproject`.INFORMATION_SCHEMA.ROUTINES.The following example retrieves all columns from theINFORMATION_SCHEMA.ROUTINES view. The metadata returned is for all routines inmydataset in your default project —myproject. The datasetmydatasetcontains a routine namedmyroutine1.
SELECT*FROMmydataset.INFORMATION_SCHEMA.ROUTINES;
INFORMATION_SCHEMA view names are case-sensitive.The result is similar to the following:
+------------------+-----------------+---------------+-----------------+----------------+--------------+--------------+-----------+--------------+--------------------+-------------------+------------------+---------------+-----------------------------+-----------------------------+-----------------------------------------------------------+| specific_catalog | specific_schema | specific_name | routine_catalog | routine_schema | routine_name | routine_type | data_type | routine_body | routine_definition | external_language | is_deterministic | security_type | created | last_altered | ddl |+------------------+-----------------+---------------+-----------------+----------------+--------------+--------------+-----------+--------------+--------------------+-------------------+------------------+---------------+-----------------------------+-----------------------------+-----------------------------------------------------------+| myproject | mydataset | myroutine1 | myproject | mydataset | myroutine1 | FUNCTION | NULL | SQL | x + 3 | NULL | NULL | NULL | 2019-10-03 17:29:00.235 UTC | 2019-10-03 17:29:00.235 UTC | CREATE FUNCTION myproject.mydataset.myroutine1(x FLOAT64) || | | | | | | | | | | | | | | | AS ( || | | | | | | | | | | | | | | | x + 3 || | | | | | | | | | | | | | | | ); |+------------------+-----------------+---------------+-----------------+----------------+--------------+--------------+-----------+--------------+--------------------+-------------------+------------------+---------------+-----------------------------+-----------------------------+-----------------------------------------------------------+
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.