Three read commands let the webview inspect schema and query plans without hand-writing
information_schema queries: tables, columns, and explain. All three return arrays of JSON
row objects.
tables
List the tables in the main schema, ordered by name.
-
Signature:
tables<T = Record<string, unknown>>(): Promise<T[]>.
-
Backed by:
columns
List a table’s columns with their type and nullability, in ordinal order.
-
Signature:
columns<T = Record<string, unknown>>(table: string): Promise<T[]>.
-
Backed by (the table name is passed as a bound parameter, not interpolated):
is_nullable is the SQL-standard 'YES'/'NO' string from information_schema, not a boolean.
explain
Return the query plan rows for a statement (DuckDB EXPLAIN).
- Signature:
explain<T = Record<string, unknown>>(query: string): Promise<T[]>.
- The backend runs
EXPLAIN <query> and returns the resulting rows.
explain passes query through the deny_risky_statements filter (on
the leading keyword), so with that policy enabled you cannot explain an ATTACH/COPY/… form.
It does not require write permission.
Permissions
Each has its own permission: better-duck-tauri:allow-tables, allow-columns, allow-explain.
None are in the default set, so grant the ones your UI needs. See
Capabilities & permissions.
See also