Show current database user

Source: R/api.R

Return or print the current database user for a MotherDuck / DuckDB connection.

Usage

show_current_user(.con, return = "msg")

Arguments

.con

A valid DBI connection (DuckDB / MotherDuck).

return

Character scalar, one of “msg” or “arg”. Default: “msg”.

Value

a tibble

Details

This helper queries the active DB connection for the current user (via ⁠SELECT current_user⁠).

The function supports two output modes:

  • “msg” — prints a small informative message and returns the result invisibly (useful for interactive use),

  • “arg” — returns a tibble containing the current_user column.

See Also

Other db-api: configure_md_user_settings(), create_md_access_token(), create_md_user(), delete_md_access_token(), delete_md_user(), list_md_active_accounts(), list_md_user_instance(), list_md_user_tokens()

Examples

# Using an existing connection
con <- connect_to_motherduck()
show_current_user(.con = con, return = "msg")