Skip to Content

The SQL statement path supports query statements plus a small set of catalog, copy, explain, and trace statements. The REPL also handles simple local CREATE TABLE name (...) and INSERT ... VALUES statements itself for session-local in-memory tables.

USE namespace

USE CATALOG spiraldb; USE PROJECT damp-unit-976647; USE DATASET default;

USE CATALOG <name> changes the session’s current relation catalog. The SQL REPL starts with the legacy SpiralDB catalog selected; local REPL tables remain available through the memory catalog.

USE PROJECT <project> selects the current SpiralDB project and resets the current dataset to default. USE DATASET <dataset> changes the dataset used for single-part SpiralDB table names.

CREATE VIEW

CREATE VIEW active_events AS SELECT id, score FROM events WHERE active;

CREATE VIEW name AS query binds the query immediately and stores the bound logical plan in the session catalog. OR REPLACE and IF NOT EXISTS are accepted. Column lists, materialized views, temporary views, view options, and other modifiers are rejected.

CREATE TABLE AS

CREATE TABLE top_events AS SELECT id, score FROM events ORDER BY score DESC LIMIT 100;

CREATE TABLE name AS query binds the query and materializes the result into a session-local in-memory table with an ordinal key. OR REPLACE and IF NOT EXISTS are accepted. Schema-only CREATE TABLE belongs to the REPL’s local-table path; the engine statement binder rejects schema-only table forms.

COPY TO

COPY ( SELECT id, score FROM events ORDER BY id ) TO './events.vortex' WITH (FORMAT vortex);

COPY TO accepts either a table source or a query source:

COPY events (id, score) TO './events.arrow' WITH (FORMAT arrow);

Current COPY TO support:

FormatNamesStatus
VortexvortexBuilt into the engine session.
Arrow IPCarrow, arrow_ipcRegistered by the default CLI Arrow plugin.
ParquetparquetNot registered; reads are supported, writes are not.

Only local file targets are implemented. FORMAT is the only supported SQL copy option. COPY FROM, COPY TO STDOUT, COPY TO STDIN, COPY TO PROGRAM, legacy copy options, URI targets, and inline copy data are not implemented.

SET trace

Trace settings configure query diagnostics for the current session:

SET trace = 'perfetto'; SET trace.output = '/tmp/spiral-trace.json'; SET trace.level = 'debug'; SET trace.next = '/tmp/next-query-trace.json';

trace accepts off, log, or perfetto. trace.level accepts error, warn, info, debug, or trace. trace.next captures only the next query as a Perfetto trace and is then consumed.

Other SET variables are rejected.

Last updated on