Print Current MotherDuck Database Context
pwd.RdDisplays the current database, schema, and role for the active DuckDB/MotherDuck connection.
This mirrors the behavior of pwd in Linux by showing your current “working database.”
Value
A tibble with columns:
- current_database
The active database name.
- current_schema
The active schema name.
The current role is printed to the console via cli.
Details
The pwd() function is a helper for inspecting the current database context of a DuckDB
or MotherDuck connection. It queries the database for the current database, schema, and role.
The database and schema are returned as a tibble for easy programmatic access, while the
role is displayed using a CLI alert. This is especially useful in multi-database environments
or when working with different user roles, providing a quick way to verify where SQL queries
will be executed.
See also
Other db-meta:
cd(),
launch_ui()