LanceDB integrates with DuckDB through the Lance extension for DuckDB. In this page, we’ll show how LanceDB manages table lifecycle, and DuckDB provides SQL analytics (including joins) and search over those tables. Note that earlier versions of LanceDB used to recommend converting Lance tables to Arrow tables viaDocumentation Index
Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
Use this file to discover all available pages before exploring further.
table.to_arrow(). Although this method is still available (because DuckDB natively scans Arrow tables), it is no longer the recommended workflow for working with Lance tables in DuckDB. This page shows how to use the Lance extension with namespace-attached LanceDB tables, allowing you to pushdown SQL queries directly to the Lance layer.
Install
Install the DuckDB CLI as per their docs and alternatively, their Python package withpip install duckdb.
Then, open the DuckDB CLI and install and load the Lance extension as follows:
SQL
Attach the directory namespace in DuckDB
Attach the LanceDB root directory as a Lance namespace:SQL
lance_ns.main.<table_name>, so the table path is lance_ns.main.lance_duck.
Write Lance table
Create thelance_duck table using SQL and populate it with sample data:
SQL
The examples below show SQL entered in the DuckDB CLI. You can run the same SQL from
Python as well, using LanceDB and DuckDB’s Python clients in your application code.
Query the table with SQL
SQL
Vector search
SQL
Full-text search
SQL
Hybrid search
SQL