Enterprise only
Use ALTER TABLE ... ALTER COLUMN to change one existing column in LanceDB
Enterprise. These statements require table ownership and use the same
validation as the REST alter_columns API.
Syntax
Specify one column and one operation per statement. To change both type and
nullability, change the type first. Each statement commits independently; a
later failure does not roll back an earlier statement. The
TYPE <type> alias
and USING <expression> clause are not supported.
These forms take a top-level column name. Follow the
identifier quoting rules for names containing spaces or
dots; a quoted name such as "a.b" identifies one column, not a nested field.
Example
For an integerquantity column on items with no null values:
Restrictions
- Type names use the same SQL mapping as
CREATE TABLE. Type changes accept only casts supported by RESTalter_columns; a cast supported in aSELECTexpression may still be rejected for schema evolution. - Drop indexes that depend on the column before changing its type, then recreate them after the change.
SET NOT NULLrejects existingNULLvalues. Deleted rows or earlier values hidden by updates can retain nulls even when live rows contain none; the error explains the required compaction.- Tables with real-time streaming enabled cannot change column types
or tighten a nullable column to
NOT NULL.DROP NOT NULLremains available. - Computed columns cannot be retyped. Columns read or written by a Function binding cannot have their type or nullability changed through these forms.
- Members of a multi-output virtual column group cannot be altered. Drop and redeclare the whole group to change its schema.