<timestamp>Tuesday, Aug 4, 2026, 4:47 PM (UTC+2)</timestamp> is there a way to see host…
- User
Tuesday, Aug 4, 2026, 4:47 PM (UTC+2)
is there a way to see host env variables in duckdb
- Assistant
I'll check how DuckDB is used in this project and what options exist for reading host env vars.
- Assistant
Yes — in the DuckDB CLI you can read a specific host env var with
getenv:sqlSELECT getenv('HOME');You can also use it in
SET:sqlSET default_null_order = getenv('DEFAULT_NULL_ORDER');Caveats:
- CLI only — not available in Python/Node/etc. clients (security)
- Requires
enable_external_access = true(default) - There is no built-in way to dump all env vars; you must know the name
Outside the CLI, pass env values in from the host process (e.g. Python
os.environ) rather than reading them from SQL. - User
is there a way to see host env variables in duckdb
- User
Tuesday, Aug 4, 2026, 4:48 PM (UTC+2)
why it fails with Error executing SQL query: "Catalog Error: Scalar Function with name getenv does not exist!\nDid you mean "get_current_time"?\n\nLINE 1: SELECT getenv('HOME') AS home;\n ^"
- Assistant
Because
getenvis CLI-only. It’s not registered as a SQL function in the DuckDB engine you get from Python/Node/nao’s SQL path — only in the interactiveduckdbshell.So when you run that query through nao (or any non-CLI client), DuckDB correctly says the scalar function doesn’t exist.
There’s no equivalent SQL function in those clients. Read the env var in the host process instead, e.g. in Python:
pythonimport os os.environ["HOME"]Or pass the value into the query as a parameter / literal from outside DuckDB.
- User
Tuesday, Aug 4, 2026, 4:49 PM (UTC+2)
is there a safe mode possible when running the engine like we run it @chat/cli/nao_core/config/databases/duckdb.py
- Assistant
I'll check how DuckDB is configured in that file and what safe-mode options apply.
- Assistant
Yes — but not as CLI “safe mode.” That (
duckdb -safe/.safe) is CLI-only.In your Ibis path, the closest equivalent is config lockdown after connect. You already do that for the Node in-memory engine in
duckdb.service.ts:71:74:apps/backend/src/services/duckdb.service.tsasync function lockDownExternalAccess(connection: DuckDBConnection): Promise<void> { await connection.run('SET enable_external_access = false'); await connection.run('SET lock_configuration = true'); }duckdb.pydoes not do that today. It only setsread_onlyfor file DBs:43:46:cli/nao_core/config/databases/duckdb.py