PATH
Applies to: Databricks SQL
Databricks Runtime 19 and above
The PATH configuration parameter sets the schema search path. When a query or DML statement references an object such as myfunc() or mytable without a catalog and schema qualifier, Databricks looks up the object in each schema on the path, in order, and uses the first match.
A new session inherits the workspace default. After the session starts, the live path is the session value. To restore the workspace default in a session, run SET PATH = DEFAULT_PATH.
The unqualified target of a DDL statement uses the current catalog and schema, not the path. Names in the query of a DDL statement, such as CREATE TABLE AS, still follow the path. Persistent views, SQL user-defined functions, and SQL SECURITY DEFINER procedures capture the path when they are created. For the full rules, see Table and view resolution.
You can set this parameter at these levels:
- Session: Use the SET PATH statement.
- Workspace: Use SQL configuration parameters (parameter name
path) or the SQL Warehouse API.
System default
system.session, system.builtin, system.ai, CURRENT_SCHEMA
Temporary functions take precedence over built-in functions of the same name, because system.session comes before system.builtin. Do not rely on temporary functions shadowing built-in functions. See Function and procedure resolution.
Examples
The following example restores the workspace default and displays the session path. SET PATH; does not print the path, so use current_path to inspect it.
-- Restore the workspace default in the session.
> SET PATH = DEFAULT_PATH;
> SELECT current_path();
system.session,system.builtin,system.ai,main.default