Skip to main content

ROUTINES

Preview

This feature is in Public Preview.

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 11.3 LTS and above check marked yes Unity Catalog only

INFORMATION_SCHEMA.ROUTINES lists the routines (functions) within the catalog.

The rows returned are limited to the routines the user is privileged to interact with.

Definition

The ROUTINES relation contains the following columns:

NameData typeNullableStandardDescription
SPECIFIC_CATALOGSTRINGNoYesCatalog containing the routine.
SPECIFIC_SCHEMASTRINGNoYesDatabase (schema) containing the routine.
SPECIFIC_NAMESTRINGNoYesSchema unique (specific) name of the routine.
ROUTINE_CATALOGSTRINGNoYesMatches SPECIFIC_CATALOG.
ROUTINE_SCHEMASTRINGNoYesMatches SPECIFIC_SCHEMA.
ROUTINE_NAMESTRINGNoYesName of the routine.
ROUTINE_TYPESTRINGNoYesAlways 'FUNCTION'. Reserved for future use.
DATA_TYPESTRINGNoYesThe result data type name, or 'TABLE' for a table valued function.
FULL_DATA_TYPESTRINGNoNoThe result data type definition, for example 'DECIMAL(10, 4)'.
CHARACTER_MAXIMUM_LENGTHINTEGERYesYesAlways NULL, reserved for future use.
CHARACTER_OCTET_LENGTHSTRINGYesYesAlways NULL, reserved for future use.
NUMERIC_PRECISIONINTEGERYesYesFor base-2 integral numeric types, FLOAT, and DOUBLE, the number of supported bits. For DECIMAL the number of digits, NULL otherwise.
NUMERIC_PRECISION_RADIXINTEGERYesYesFor DECIMAL 10, for all other numeric types 2, NULL otherwise.
NUMERIC_SCALEINTEGERYesYesFor integral numeric types 0, for DECIMAL the number of digits to the right of the decimal point, NULL otherwise.
DATETIME_PRECISIONINTEGERYesYesFor DATE 0, for TIMESTAMP, and INTERVALSECOND 3, any other INTERVAL 0, NULL otherwise.
INTERVAL_TYPESTRINGYesYesFor INTERVAL the unit portion of the interval, e.g. 'YEAR TO MONTH', NULL otherwise.
INTERVAL_PRECISIONINTERALYesYesAlways NULL, reserved for future use.
MAXIMUM_CARDINALITYINTEGERYesYesAlways NULL, reserved for future use.
ROUTINE_BODYSTRINGNoYes'SQL' or 'PYTHON'.
ROUTINE_DEFINITIONSTRINGYesYesThe full definition of the routine. NULL if the user is not the owner.
EXTERNAL_NAMESTRINGYesYesAlways NULL, reserved for future use.
EXTERNAL_LANGUAGESTRINGYesYesAlways NULL, reserved for future use.
PARAMETER_STYLESTRINGYesYes'SQL', reserved for future use.
IS_DETERMINISTICSTRINGNoYes'YES' if routine defined as deterministic, 'NO' otherwise.
SQL_DATA_ACCESSSTRINGNoYes'READS SQL DATA' if routine reads from a relation, 'CONSTAINS SQL' otherwise.
IS_NULL_CALLSTRINGYesYesAlways 'YES', reserved for future use.
SQL_PATHSTRINGYesYesAlways NULL, reserved for future use.
SECURITY_TYPESTRINGNoYesAlways 'DEFINER', reserved for future use.
AS_LOCATORSTRINGNoYesAlways 'NO', reserved for future use.
COMMENTSTRINGYesNoAn optional comment describing the routine.
CREATEDTIMESTAMPNoNoTimestamp when the routine was created.
CREATED_BYSTRINGNoNoPrincipal which created the routine.
LAST_ALTEREDTIMESTAMPNoNoTimestamp when the routine definition was last altered in any way.
LAST_ALTERED_BYSTRINGNoNoPrincipal which last altered the routine.

Constraints

The following constraints apply to the ROUTINES relation:

ClassNameColumn ListDescription
Primary keyROUTINES_PKSPECIFIC_CATALOG, SPECIFIC_SCHEMA, SPECIFIC_NAMEUniquely identifies the routine.
Foreign keyROUTINES_SCHEMATA_FKSPECIFIC_CATALOG, SPECIFIC_SCHEMAReferences SCHEMATA

Examples

SQL
> SELECT routine_name, routine_definition
FROM information_schema.routines
WHERE specific_schema = 'default'
ORDER BY routine_name;