# `Arcadic.MaterializedView`
[🔗](https://github.com/baselabs/arcadic/blob/baselabs_arcadic-v4.0.1/lib/arcadic/materialized_view.ex#L5)

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.

# `create`

```elixir
@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_sql` — `select_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!`

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

Creates a materialized view, raising on error.

# `drop`

```elixir
@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!`

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

Drops a materialized view, raising on error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
