Arcadic.MaterializedView (Arcadic v0.7.1)

Copy Markdown View Source

ArcadeDB materialized views — tenant-blind CREATE MATERIALIZED VIEW / DROP MATERIALIZED VIEW DDL, parallel to Arcadic.Function/Arcadic.Trigger/Arcadic.Geo.

Unlike Arcadic.Function/Arcadic.Trigger, the view's SELECT statement is deliberately NOT routed through a DDL-body reject-not-escape guard: it is raw trailing SQL, not a "..."-quoted literal, so a 'single-quoted string' inside a WHERE clause is legitimate SQL and must pass through verbatim. Its injection safety instead rests on ArcadeDB's live-verified single-statement backstop — a ;-separated second statement is a parse error — so the SELECT cannot smuggle a second command regardless of its content. The name is the only identifier injection surface (interpolated behind Arcadic.Identifier, closed by construction). DROP MATERIALIZED VIEW takes no IF EXISTS clause (mirrors Arcadic.Trigger) — dropping a missing view is a server error.

Summary

Functions

Creates a materialized view name from select_sql, emitting CREATE MATERIALIZED VIEW name AS select_sqlselect_sql rides through verbatim (see moduledoc for the injection-safety rationale).

Creates a materialized view, raising on error.

Drops a materialized view name (no IF EXISTS — a missing view is a server error). Value-free on a bad name.

Drops a materialized view, raising on error.

Functions

create(conn, name, select_sql)

@spec create(Arcadic.Conn.t(), String.t(), String.t()) ::
  :ok | {:error, atom() | Exception.t()}

Creates a materialized view name from select_sql, emitting CREATE MATERIALIZED VIEW name AS select_sqlselect_sql rides through verbatim (see moduledoc for the injection-safety rationale).

Value-free on a bad name (:invalid_identifier). A non-binary select_sql is a caller-contract violation and raises ArgumentError value-free (never echoes the offending value).

create!(conn, name, select_sql)

@spec create!(Arcadic.Conn.t(), String.t(), String.t()) :: :ok

Creates a materialized view, raising on error.

drop(conn, name)

@spec drop(Arcadic.Conn.t(), String.t()) :: :ok | {:error, atom() | Exception.t()}

Drops a materialized view name (no IF EXISTS — a missing view is a server error). Value-free on a bad name.

drop!(conn, name)

@spec drop!(Arcadic.Conn.t(), String.t()) :: :ok

Drops a materialized view, raising on error.