Skip to content

Autocomplete functions in the Fuzzycomplete DuckDB extension

Function category

Autocomplete

1 function

sql_auto_complete

Table function Autocomplete
Signature
sql_auto_complete( sql: VARCHAR, max_exact_suggestion_count := UBIGINT, max_file_suggestion_count := UBIGINT, max_suggestion_count := UBIGINT ) → None
Arguments
Argument sql 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. Positional only.
Argument max_suggestion_count Type UBIGINT Mode Named Description Maximum number of suggestions to return (default 20). Values larger than the number of candidates are fine. Accepted for compatibility with the stock autocomplete extension.
Argument max_file_suggestion_count Type UBIGINT Mode Named Description Maximum number of file and directory suggestions to return (default 20). Accepted for compatibility with the stock autocomplete extension.
Argument max_exact_suggestion_count Type UBIGINT Mode Named Description Accepted for compatibility with the stock autocomplete extension; has no effect, since fuzzy matching has no exact-only tail.
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');
4 Columns of the table named in the query rank first among equally good matches (DuckDB 2.0 build `2026110701` and later).
CREATE TABLE store_inventory (order_quantity INTEGER);
CREATE TABLE customer_order_history (order_id INTEGER);

SELECT suggestion, suggestion_type
FROM sql_auto_complete('SELECT * FROM store_inventory WHERE ordr')
LIMIT 1;