Materialized view support for AshScylla.
Materialized views in ScyllaDB/Cassandra allow you to define a view with a different primary key structure from the base table. This enables efficient queries on non-primary key columns without using secondary indexes.
Usage
Define a materialized view in your resource DSL:
defmodule MyApp.MyResource do
use Ash.Resource,
data_layer: AshScylla.DataLayer
ash_scylla do
table "users"
materialized_view :users_by_email,
primary_key: [:email, :id],
include_columns: [:name, :age]
end
endThis will generate:
CREATE MATERIALIZED VIEW IF NOT EXISTS users_by_email
AS SELECT id, email, name, age
FROM users
WHERE email IS NOT NULL AND id IS NOT NULL
PRIMARY KEY (email, id)
WITH CLUSTERING ORDER BY (id ASC)Options
:primary_key— Required. The primary key columns for the view.:include_columns— Additional columns to include (besides PK).:clustering_order— Clustering column ordering (e.g.,[id: :desc]).:where_clause— Custom WHERE clause for NOT NULL constraints.
Summary
Functions
Generates CQL for creating a materialized view.
Generates CQL for dropping a materialized view.
Validates a materialized view configuration.
Types
Functions
Generates CQL for creating a materialized view.
Generates CQL for dropping a materialized view.
Validates a materialized view configuration.