Skip to content

Autocomplete functions in the Fuzzycomplete DuckDB extension

Function category

Autocomplete

1 function

Inspect what the fuzzy completer would suggest for a given partial query. Once the extension is loaded the DuckDB CLI uses this internally for Tab-completion — the function exists mainly for testing and for scripts that want to surface suggestions programmatically.

sql_auto_complete

Scalar function Autocomplete
Signature
sql_auto_complete(query: VARCHAR)
Arguments (Positional)
Argument query Type VARCHAR Mode Positional Description The partial SQL text the user has typed. Suggestions are ranked by fuzzy match score against keywords and identifiers (databases, schemas, tables, columns) currently visible to the session.
Description
1 Complete a SQL keyword — the top suggestion for `SEL` is `SELECT`.
SELECT trim(suggestion) AS suggestion
FROM sql_auto_complete('SEL')
LIMIT 3;
2 Suggest a table name after `FROM` — the completer walks every attached database and schema in the search path.
SELECT suggestion
FROM sql_auto_complete('SELECT * FROM tables')
LIMIT 1;
3 Substring + camelCase matching — typing `gnst` finds `getNotificationStatus` even though it isn't a prefix.
SELECT suggestion
FROM sql_auto_complete('SELECT * FROM gnst');