DuckDB Extension
Fuzzycomplete
Add fuzzy Tab completion to the DuckDB CLI. Find SQL keywords and table names from abbreviated input, including names in attached databases.
On this page
Complete abbreviated names while writing SQL
Fuzzycomplete changes Tab completion in the interactive DuckDB CLI. It ranks keywords and identifiers by how well they match the characters you typed, including abbreviated names and characters at word boundaries.
Use it when you explore unfamiliar schemas or work across several attached databases. Suggestions can include qualified names from those catalogs. It changes the CLI’s input experience; for comparing strings stored in tables, use RapidFuzz instead.
Example
Enable fuzzy completion in the CLI
Load the extension and create a sample table. Then use the CLI’s Tab key to complete its name.
Before you run it: Use the interactive DuckDB CLI. This example was checked with DuckDB 1.5.6 and Fuzzycomplete build 8b89b19 from the community repository. If you installed it previously, update and verify completion first.
Run this example in the DuckDB CLI or a native client.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL fuzzycomplete FROM query_farm;
LOAD fuzzycomplete FROM query_farm;
CREATE TEMP TABLE customer_orders (id INTEGER);
-- At the next CLI prompt, type SELECT * FROM cust and press Tab.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://haybarn-extensions.query.farm';
INSTALL fuzzycomplete FROM query_farm;
LOAD fuzzycomplete FROM query_farm;
CREATE TEMP TABLE customer_orders (id INTEGER);
-- At the next CLI prompt, type SELECT * FROM cust and press Tab.
INSTALL fuzzycomplete FROM community;
LOAD fuzzycomplete;
CREATE TEMP TABLE customer_orders (id INTEGER);
-- At the next CLI prompt, type SELECT * FROM cust and press Tab.
Tab completion is an interactive action, so there is no query-result table here. Loading this extension in Python, JDBC, or another embedded client does not add a CLI input loop.
Common tasks
Deep Dive
Technical Details
These examples use DuckDB 2.0 or later. Complete the repository setup and installation first.
What changes the moment you load it
After registering the repository, install and load it in the DuckDB CLI:
INSTALL fuzzycomplete FROM query_farm;LOAD fuzzycomplete FROM query_farm;From there on, every Tab in the shell is fuzzy-matched. Type usrs and Tab, and users is the first suggestion. Type gnst against a table called getNotificationStatus — it appears at the top, because matches at camelCase word starts get a bonus. ATTACH a second database and Tab through FROM — completions span both catalogs, properly qualified.
Fuzzycomplete plugs into the DuckDB CLI’s interactive line editor. It has no effect when DuckDB is embedded in another process — Python, Node.js, JDBC/ODBC, Rust, WASM, and other client libraries don’t have a CLI input loop to hook into. If you want fuzzy string scoring inside SQL queries themselves, use rapidfuzz.
How it ranks suggestions
Fuzzycomplete uses the Rust crate code-fuzzy-match — a port of the matcher Visual Studio Code uses for its command palette and Quick Open. The matching rules:
- Ordered subsequence. Every character of your query must appear in the candidate, in order. They don’t have to be contiguous —
usrmatchesusersanduser_settingsbut notsetUR. - Word-boundary bonuses. Characters that follow a separator (
_,.) or sit at a camelCase boundary score higher. That’s whygNSreliably picksgetNotificationStatus. - Run bonuses. Contiguous match runs score higher than scattered hits —
usersbeatsu_e_r_sfor the queryusr. - Tie-breakers. Equal fuzzy scores break by relevance, then by fewer
_/.separated parts, then lexicographically. Relevance (DuckDB 2.0, build2026110701and later):SELECT, thenFROM/INSERT/UPDATE/DELETE, before other keywords; your own tables, views, catalogs and schemas before built-in ones; columns of the tables named anywhere in the statement before other columns; columns before functions.suggestion_scorestill reports only the fuzzy match, so the shell keeps listing equally good matches instead of picking one. - Comments. Text inside
--and/* */comments is skipped; inside an unterminated comment there are no suggestions. Block comments are recognised on DuckDB 2.0 from build2026110701.
Replaces, not supplements, the built-in
DuckDB ships an autocomplete extension that uses edit-distance scoring. Both extensions register sql_auto_complete, which the CLI calls for Tab-completion. With the v1.5 activation fix, LOAD fuzzycomplete FROM query_farm replaces an already loaded stock provider. Run it after the CLI’s startup loading, or in your ~/.duckdbrc. If you explicitly load both providers, load autocomplete first; loading it for the first time after fuzzycomplete can fail with a duplicate-overload error.
Update and verify completion
To replace a previously installed copy, run:
FORCE INSTALL fuzzycomplete FROM query_farm;Then close and reopen the DuckDB CLI so it loads the new binary. Verify the installed build and the active matcher:
LOAD fuzzycomplete FROM query_farm;
SELECT extension_versionFROM duckdb_extensions()WHERE extension_name = 'fuzzycomplete';
SELECT trim(suggestion) AS suggestion, suggestion_startFROM sql_auto_complete('SLCT');The second query should return exactly one row: SELECT with suggestion_start = 0. Build 9746833 leaves the stock provider active when it is already loaded, even though LOAD fuzzycomplete succeeds. If suggestions still look wrong after updating, check that fuzzycomplete is loaded after autocomplete, including in your ~/.duckdbrc.
Inspecting the matcher from SQL
Tab-completion in the CLI calls sql_auto_complete under the hood, but you can also query it directly — useful for sanity-checking ranking, for tests, or for scripts that want to surface suggestions:
SELECT trim(suggestion) AS suggestionFROM sql_auto_complete('SELECT * FROM ord')LIMIT 5;The function returns rows ordered best-first. It walks the live catalog, so newly ATTACH-ed databases and freshly created tables show up immediately — there’s no separate index to refresh.
Each row has the same five columns as the stock extension, which the DuckDB shell reads by position:
| Column | Type | Meaning |
|---|---|---|
suggestion |
VARCHAR |
The completion text. Keywords end in a space; catalog and schema names end in . |
suggestion_start |
INTEGER |
Offset in the input where the completion replaces text |
suggestion_type |
VARCHAR |
keyword, catalog, schema, table, table_function, column, scalar_function, file_name or directory |
suggestion_score |
UBIGINT |
Distance from the best fuzzy match: 0 for the best, lower is better, equal scores are ties |
extra_char |
VARCHAR |
The character the shell appends after accepting: a space after keywords, . after catalogs and schemas, the path separator after directories, a quote after file names |
The stock extension’s named parameters are accepted too: max_suggestion_count caps the number of suggestions (default 20) and max_file_suggestion_count the number of file and directory suggestions, e.g. sql_auto_complete('SELECT * FROM ', max_suggestion_count := 5). max_exact_suggestion_count is accepted but has no effect, since fuzzy matching has no exact-only tail.
File names and the sandbox
Inside a string literal the completer lists the files in the directory you are typing (directories end in the path separator, files in a closing quote). It goes through DuckDB’s file system, so with SET enable_external_access = false file and directory completion fails with a Permission Error (the shell then shows no suggestions); keyword, table and column completion keep working. On DuckDB 2.0 from build 2026110701, file names that are not valid UTF-8 are skipped; earlier builds aborted the shell when Tab-completing in a directory that contained one.
What’s in the box
| Surface | Where it lives |
|---|---|
| Tab-completion in the CLI | Implicit — DuckDB’s line editor calls sql_auto_complete on every Tab |
sql_auto_complete(sql) |
One table function; returns ranked suggestions for a partial SQL string |
| Configuration | None — install, load, done |
For SQL-level fuzzy primitives (similarity scores, distances, record linkage) load rapidfuzz. For prefix-tree lookups against large dictionaries, load marisa.
Reference
Extension Contents
Quick reference to all available functions and settings organized by category.
| Name | Type | Description |
|---|---|---|
|
Autocomplete
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() | Object type: Table function | Return ranked autocomplete suggestions for a partial SQL string using the VS-Code-derived fuzzy matcher. |
No extension contents match that search.
API Reference
Function Reference
Practical Examples
Cookbook
Real-world recipes and patterns for common use cases.
These examples use DuckDB 2.0 or later. Complete the repository setup and installation first.
What this changes
fuzzycomplete replaces DuckDB’s stock autocomplete with code-fuzzy-match — the same fuzzy matcher VS Code uses. Once loaded, hitting Tab in the DuckDB CLI matches:
- Substrings — typing
usrsfindsusers. - Camel-case word starts —
gnstfindsgetNotificationStatus. - Across databases & schemas — completion respects the search path even with multiple
ATTACH-ed databases.
It’s a CLI-only quality-of-life win — there’s no SQL surface to call.
Setup
LOAD fuzzycomplete FROM query_farm;After loading, completion in the CLI uses the new algorithm automatically. No configuration needed.
When you’ll notice the difference
- Long table names — fuzzy substring matches reach the right table without typing the full prefix.
- Multi-DB sessions — completion includes tables from every attached database, with the right qualifier.
- Code-style identifiers — camelCase / snake_case word starts are weighted properly.
For applications, IDEs, and other clients connecting to DuckDB programmatically, this extension has no effect — it’s the CLI’s input loop only.
Platform Support
Compatibility
Extension availability may vary by platform and DuckDB version. Check below to ensure this extension supports your environment before installation.
Quick Facts
Platforms
DuckDB 2.0.0
- Linux x86_64aarch64
- Linux (musl) Not available
- macOS Apple Silicon
- Windows x86_64x86_64 (MinGW)
- WASM Not available
Compiled binary sizes
| Platform | Architecture | Size |
|---|---|---|
| Linux | x86_64 | 5.04 MB |
| Linux | aarch64 | 4.37 MB |
| macOS | Apple Silicon | 2.98 MB |
| Windows | x86_64 | 10.26 MB |
| Windows | x86_64 (MinGW) | 19.05 MB |
Compressed download sizes for the release shown above.
DuckDB & Haybarn
Release calendar- DuckDB v2.0.0 Query.Farm repository Supported
- Haybarn v1.5.6 Built-in community repository Supported
Browser examples use Haybarn-Wasm 2.0.0-rc12.
Checked .
Learn and explore
Tutorials and articles
Writing about Fuzzycomplete: how it works, what changed, and why.
-
Fuzzycomplete for DuckDB 2.0: put the useful suggestion first
Fuzzycomplete now ranks relevant tables and columns first, handles SQL comments, and matches DuckDB 2.0 shell completion metadata without hiding tied matches.