mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-12 14:52:26 +00:00
Move the public website pages into `docs/web` beside the SDK, with
shared navigation and executable example sources in `docs/web-tests`.
The combined website is assembled by
[lancedb/docs#355](https://github.com/lancedb/docs/pull/355), with six
Enterprise replacements from
[lancedb/sophon#7681](https://github.com/lancedb/sophon/pull/7681).
This includes Function guidance, runnable Quickstarts, regenerated
snippets, production contact/demo fixes, the legacy SQL route, and the
LeRobot redirect. LeRobot remains attributed to Geneva; all 34 Geneva
pages remain in the docs repository until Function officially launches.
Materialized-view guidance follows the full rebuild refresh introduced
by #4373: local refresh writes the complete result, has no `full`
argument, supports `source_version`, and no longer requires stable row
IDs. Deployment SQL refresh options and stable-ID setup are qualified by
version/configuration. Function input guidance distinguishes ordinary
stored columns from computed inputs supported by newer deployments.
**Validation:** independently accepted local checks include 95 Python
tests (real Enterprise excluded), eight TypeScript tests, Rust
Quickstart, snippet parity, typos, deterministic assembly, Mint
validation and links/anchors/redirects. The combined baseline retains
all 181 production routes and 17 legacy redirects. Examples ran locally
against source-built Python SDK 0.40.0b13; existing GitHub workflows do
not run `docs/web-tests`. New main at `069b2f7d` is 0.41.0b0 and adds
computed Function inputs; that SDK was not exercised by the accepted
tests. Latest prose corrections receive focused site validation.
**Merge/rollout:** merge this and #7681 before #355's combined CI, which
reads producer `main`. This is migration infrastructure: section
overlays, source-owned skills and automatic versioned paired releases
remain follow-ups. The current manual publisher is transitional. Hosted
validation, a supported SDK/Enterprise release pair and a real
Enterprise walkthrough remain pending.
Production Mintlify watches `lancedb/docs:deploy-freeze`, directory
`docs`; preserve that source through review. The separate SDK GitHub
Pages reference workflow rebuilds on main merges.
**Updated-head CI (9a50f8db):**
[Typos](https://github.com/lancedb/lancedb/actions/runs/37654185443/job/112904990558),
[PR
title](https://github.com/lancedb/lancedb/actions/runs/37654179507/job/112904974595)
and
[Aikido](https://app.aikido.dev/featurebranch/scan/215386145?groupId=74229)
pass. Critical findings in the example lockfiles were patched: all Sharp
copies use 0.35.5, protobufjs 7.6.6, tar 7.5.22, quinn-proto 0.11.19,
zerovec 0.11.8 and zerovec-derive 0.11.6. The SDK's product dependencies
are unchanged. The revised lockfiles pass eight TypeScript examples,
HuggingFace decode/resize/crop/rescale/normalize plus AVIF roundtrip,
and Rust Quickstart. Aikido passing does not mean every advisory is
cleared; npm still reports 29 high and five moderate advisories in the
example dependency graph. No scanner bypass or suppression was added.
The Function prose correction passes combined/standalone Mint,
deterministic assembly, routes and assets. The revised 325-file site
checksum is
`175bec06864abb400dd292e667ba93448c0479b8359fd7bf6146afabf9040647`. This
PR remains open for independent review; further merges are on hold.
---------
Co-authored-by: Brendan Clement <brendan.clement@lancedb.com>
126 lines
5.1 KiB
Plaintext
126 lines
5.1 KiB
Plaintext
---
|
|
title: "SQL"
|
|
sidebarTitle: "SQL"
|
|
description: "The same tables, reached with SQL — the universal access path, and where every operation is formally documented."
|
|
icon: table-list
|
|
keywords: ["sql", "flight sql", "datafusion", "reference", "dialect"]
|
|
---
|
|
|
|
<Badge color="red">Enterprise</Badge> SQL runs on a deployment. A local
|
|
database has no engine to plan a statement, so `execute_query` raises there.
|
|
|
|
SQL is a second way to reach the same tables the [SDKs](/basics/sdk) do --
|
|
not a different product, a different interface onto one engine. A table
|
|
written from Python is queried from SQL without an export step, and a table
|
|
created from SQL is visible to every SDK immediately.
|
|
|
|
## Any language, via Flight SQL {#flight-sql}
|
|
|
|
SQL is served over an
|
|
[Arrow Flight SQL](https://arrow.apache.org/docs/format/FlightSql.html)
|
|
endpoint, so any Flight SQL client reaches it -- which makes SQL the way in
|
|
for a language LanceDB has no SDK for. You don't need a LanceDB-specific
|
|
client at all, just a Flight SQL driver for your language.
|
|
|
|
The TypeScript SDK itself has no SQL method, for the same reason a Go or C#
|
|
application would reach for SQL first: connect a Flight SQL client instead of
|
|
waiting on a native binding. See [SDKs](/basics/sdk) for the officially
|
|
supported and community clients, and reach for Flight SQL whenever yours
|
|
isn't among them.
|
|
|
|
## Every SDK operation, in SQL {#sdk-parity}
|
|
|
|
Broadly, a public SDK method has a corresponding SQL statement -- creating a
|
|
table is `CREATE TABLE`, inserting rows is `INSERT INTO`, building an index is
|
|
`CREATE INDEX`. The two describe the same operations, so whichever one your
|
|
code speaks, the other is available too.
|
|
|
|
| | SDK | SQL |
|
|
| --- | :---: | :---: |
|
|
| Create and manage catalog objects | yes | partly |
|
|
| Insert, merge, update, delete | yes | yes |
|
|
| Filter, project, aggregate, join | yes | yes |
|
|
| Vector search | yes | version-dependent |
|
|
| Full-text search | yes | yes |
|
|
| Feature engineering, jobs | yes | yes |
|
|
| Runs against a local database | yes | **no** |
|
|
|
|
## Vector search depends on the deployment {#no-vector-sql}
|
|
|
|
The SDK query builder provides vector search across embedded and deployed
|
|
databases. SQL support depends on the deployment version and supported query
|
|
shape. Some versions recognize `ORDER BY distance(vector, query_vector) LIMIT k`
|
|
over a table scan and plan vector search, including indexed and flat search.
|
|
Confirm support on your deployment and use SQL
|
|
[`EXPLAIN`](/sql/dql/explain) to check the chosen plan; this is not a guarantee
|
|
that every deployed release supports that form.
|
|
|
|
Full-text search is available through the [`fts()`](/sql/functions#fts) table
|
|
function and the [`contains_tokens`](/sql/scalar-functions#contains-tokens)
|
|
predicate.
|
|
|
|
The reverse gap also exists: a [view](/management/view) is a saved SQL query,
|
|
so SQL is the only way to create one -- there's nothing for an SDK method to
|
|
call.
|
|
|
|
## SQL needs a deployment {#sql-is-remote}
|
|
|
|
A connection to a directory or a bucket has no server to plan and execute a
|
|
statement, and asking it to raises `NotImplementedError`. This is the largest
|
|
behavioral difference between the embedded and deployed forms, and the reason
|
|
the SDKs are the portable choice: SDK code moves between the two by changing
|
|
the URI, SQL does not.
|
|
|
|
```python
|
|
db = lancedb.connect("./.lancedb") # no SQL
|
|
db = lancedb.connect("db://my-database") # SQL
|
|
```
|
|
|
|
## Running SQL from Python {#sql-from-python}
|
|
|
|
```python
|
|
reader = db.execute_query("SELECT id, text FROM my_docs LIMIT 10")
|
|
table = reader.read_all()
|
|
```
|
|
|
|
`execute_query` returns a blocking Arrow reader once results start arriving; it
|
|
does not wait for the whole query. `execute_query_async` returns a handle
|
|
instead -- see [Queries](/basics/query).
|
|
|
|
## Choosing between them {#choosing}
|
|
|
|
Reach for **the SDKs** when you are writing data, managing the catalog, running
|
|
vector search, or building an application that should work the same embedded and
|
|
deployed.
|
|
|
|
Reach for **SQL** when the question is analytical -- joins across tables,
|
|
aggregates, window functions -- when the thing asking is a BI tool, a
|
|
notebook, or a person who already thinks in SQL, or when it's the only client
|
|
available for your language.
|
|
|
|
The two compose. A common shape is SDK code to build and maintain tables, and
|
|
SQL for the analysis on top.
|
|
|
|
## The complete reference {#reference}
|
|
|
|
This page is the concept; [SQL Reference](/sql) is the specification. It has
|
|
one page per statement, syntax first -- and since every SDK operation has a
|
|
SQL form, those pages end up defining the precise behavior of the SDK
|
|
operations too, not just the SQL dialect.
|
|
|
|
<Card title="SQL Reference" icon="table-list" href="/sql">
|
|
DDL by object, then DML, then DQL -- the detailed technical documentation
|
|
that defines the behavior of every operation and SDK API.
|
|
</Card>
|
|
|
|
## What to read next {#next}
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="SDKs" icon="code-compare" href="/basics/sdk">
|
|
The language clients, and what stays true across all of them.
|
|
</Card>
|
|
<Card title="Agentic Skills" icon="robot" href="/basics/agentic-skills">
|
|
Give a coding agent a current reference to this same API surface.
|
|
</Card>
|
|
</CardGroup>
|