メインコンテンツまでスキップ

current_path function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 19 and above

Returns the current session PATH as a comma-separated list of qualified schema names. To change the path, use SET PATH.

Syntax​

current_path()

The parentheses are optional.

Arguments​

This function takes no arguments.

Returns​

A STRING.

Each path entry is a dotted, catalog-qualified name, and entries are separated by a comma with no spaces. Backticks appear only when an identifier contains a character that requires quoting, such as a dot. The virtual CURRENT_SCHEMA entry expands to the current catalog and schema when the function is evaluated.

注記

Inside a persistent view or SQL user-defined function body, current_path() returns the invoker's session path, not the path captured when the object was created. Inside a SQL SECURITY DEFINER procedure body, it returns the path captured when the procedure was created, without system.session. See Captured path.

Examples​

SQL
> SET PATH = DEFAULT_PATH, libraries.pgsql;

> SELECT current_path();
system.session,system.builtin,system.ai,main.default,libraries.pgsql

-- Parentheses are optional.
> SELECT current_path;
system.session,system.builtin,system.ai,main.default,libraries.pgsql

-- Identifiers that contain a dot are backtick-quoted.
> SET PATH = SYSTEM_PATH, spark_catalog.`sch.b`;
> SELECT current_path();
system.builtin,system.ai,spark_catalog.`sch.b`