Skip to main content
DB

SQL reference

DROP

Every DROP form the engine accepts — tables, indexes, views, materialized views, transformations, sources, credentials, access and users.

Each object kind has its own DROP form. Use the form that matches the object.

StatementIF EXISTSRemoves
DROP TABLE <name>yesA table and its data.
DROP INDEX <index> ON <table>yesOne secondary index.
DROP VIEW <name>yesA logical view.
DROP MATERIALIZED VIEW <name>yesA materialized view or template and its engine-owned rows.
DROP MATERIALIZATION <name>yesOne instance of a materialized view template.
DROP TRANSFORMATION <name>yesA transformation; its target table stays.
DROP SOURCE <name>noA federated source and its external relations.
DROP CREDENTIAL <uuid>noA stored federation credential.
DROP APPLICATION ACCESS <name>noAn application access.
DROP USER <name>noDisables a user.
DROP API KEY <label> FOR USER <name>noDisables an API key.

With IF EXISTS, a missing object is a successful no-op. Each statement drops one object.

Tables

DROP TABLE transfers;

Views and definitions that read a table are dropped before the table.

DROP TABLE IF EXISTS transfers;

Indexes

DROP INDEX transfers_ts ON transfers;
DROP INDEX IF EXISTS transfers_ts ON transfers;

The table name is part of the statement: an index is named within its table.

Views

DROP VIEW token_volume;
DROP VIEW IF EXISTS token_volume;

The IF EXISTS form on a missing view answers success with "applied":false.

Materialized views and materializations

Materializations of a template are dropped before the template.

DROP MATERIALIZATION balances_chain_1;
DROP MATERIALIZED VIEW balances_by_chain;

After the drop, reading the name answers HTTP 404.

Transformations

DROP TRANSFORMATION balance_activity;
DROP TRANSFORMATION IF EXISTS balance_activity;

Dropping a transformation stops the writer. The target table keeps its rows.

Federation objects

Federation statements run on a WebSocket session. See Federation for the statements that create these objects.

DROP SOURCE ledger
DROP CREDENTIAL 6f1c2d3e-4a5b-4c6d-8e9f-0a1b2c3d4e5f

A credential belongs to the tenant that imported it. After it is dropped, its credential file is removed.

DROP APPLICATION ACCESS analytics_reader

Dropping an application access removes its authentication policy.

Users and API keys

DROP USER and DROP API KEY disable the credential; the sessions that depend on it end on their next operation. See Users and API keys.

DROP USER analyst
DROP API KEY reporting FOR USER analyst

After DROP API KEY, the key's secret no longer signs in.

On this page