mirror of
https://github.com/lancedb/lancedb.git
synced 2026-10-16 08:42:29 +00:00
This PR is part of the documentation revamp. Once the full set of PRs is merged, we’ll publish the combined site to staging for review before updating docs.lancedb.com. The curation, SQL and operations pages contain outdated claims and examples that do not reliably work as written. This corrects those pages against the reviewed SDK and local server evidence, including prepared statements, background jobs, cleanup and monitoring. Integration guides are grouped with their examples in #4533. Function and Secret-object documentation stays unpublished until its release. The two Function pages are listed in `.mintignore` and left out of the navigation, and the sections about them on other pages are MDX comments. Stacked on #4533. Each MDX file has one PR owner. Rebase onto main after #4533 is squash-merged. Local assembly, Mint validation and link checks pass, and the assembled site shows no Function or Secret-object content. A local release rehearsal that uncomments the drafts and restores the navigation also passes. Hold publication until this PR and lancedb/sophon#8688 are on `main`.
56 lines
1.7 KiB
Plaintext
56 lines
1.7 KiB
Plaintext
---
|
|
title: "Namespace"
|
|
sidebarTitle: "Namespace"
|
|
description: "CREATE SCHEMA and DROP SCHEMA — the SQL spelling of namespace DDL."
|
|
icon: folder-tree
|
|
keywords: ["namespace", "schema", "create schema", "drop schema", "sql"]
|
|
---
|
|
|
|
<Badge color="red">Enterprise</Badge> [SQL runs in LanceDB Enterprise.](/sql)
|
|
|
|
A [namespace](/management/namespace) is addressed in SQL as a `SCHEMA` -- the
|
|
standard's name for the same concept.
|
|
|
|
## CREATE SCHEMA {#create}
|
|
|
|
```sql
|
|
CREATE SCHEMA analytics
|
|
CREATE SCHEMA db1.`ns1$ns2`
|
|
CREATE SCHEMA IF NOT EXISTS `ns1$ns2`
|
|
```
|
|
|
|
A nested namespace is one backtick-quoted name with `$` between its
|
|
components: `` db1.`ns1$ns2` `` creates `ns2` inside `ns1` in database `db1`,
|
|
provided `ns1` already exists. The part before the dot is the database, so a
|
|
three-part path such as `db1.ns1.ns2` is rejected. `public` is the database's
|
|
root namespace, which is never created or dropped.
|
|
|
|
`IF NOT EXISTS` makes the statement a no-op rather than an error when the
|
|
namespace is already there.
|
|
|
|
## DROP SCHEMA {#drop}
|
|
|
|
```sql
|
|
DROP SCHEMA db1.analytics
|
|
DROP SCHEMA IF EXISTS `a$b`
|
|
DROP SCHEMA `a$b` RESTRICT
|
|
```
|
|
|
|
<Warning>
|
|
`CASCADE` is rejected: **"DROP SCHEMA CASCADE is not supported; drop the
|
|
objects inside first."** A namespace's tables, views and other objects must be
|
|
dropped explicitly before the namespace itself can go. `RESTRICT` -- the
|
|
default -- states that requirement rather than changing it.
|
|
</Warning>
|
|
|
|
## What to read next {#next}
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Namespace" icon="folder-tree" href="/management/namespace">
|
|
The SDK equivalent, and how a namespace fits the catalog hierarchy.
|
|
</Card>
|
|
<Card title="Table" icon="table" href="/sql/ddl/table">
|
|
Creating tables inside a namespace.
|
|
</Card>
|
|
</CardGroup>
|