Alter

The Airport extension supports altering tables. The Arrow Flight server can decide if the alteration should be applied..

Example

For a DuckDB session to alter a table, a standard SQL ALTER TABLE statement is executed in a schema that is managed by the Airport extension.

-- Attach an Airport database
ATTACH 'example' (TYPE AIRPORT, location 'grpc://localhost:50312/');

-- assume that there is a `main` schema
-- already in the `example` database
CREATE TABLE example.main.employees (
  name varchar,
  id integer
);

ALTER TABLE example.main.employees DROP COLUMN id;

Arrow Flight Server Implementation Notes

The Airport extension will perform a DoAction Arrow Flight RPC with a method name that corresponds to the type of alteration being performed.

The types of alterations that can be performed are:

Action Name Description
add_column Add a column to a table.
add_constraint Add a constraint to a field.
add_field Add a field to a structure.
change_column_type Change the type of a column.
drop_not_null Drop NOT NULL constraint from a field.
remove_column Remove a column from a table.
remove_field Remove a field from a structure.
rename_column Rename a column.
rename_field Rename a field in a structure.
rename_table Rename a table.
set_default Set a default value for a field.
set_not_null Set a field to NOT NULL.

Each type of alteration takes a different parameter structure.

All actions are presumed not to return a value, but should raise an exception upon error.