AshScylla.DataLayer (AshScylla v0.1.1)

Copy Markdown View Source

An Ash data layer for ScyllaDB using Exandra (Ecto adapter for Cassandra/ScyllaDB).

This data layer implements the Ash.DataLayer behaviour to allow Ash resources to be backed by ScyllaDB/Cassandra.

Configuration

Configure your resource to use this data layer:

defmodule MyApp.MyResource do
  use Ash.Resource,
    data_layer: AshScylla.DataLayer

  attributes do
    uuid_primary_key :id
    attribute :name, :string
  end

  relationships do
    # Define relationships as needed
  end
end

Features Supported

  • :create - Create records
  • :read - Read records with filtering
  • :update - Update records
  • :destroy - Delete records
  • :filter - Filter queries
  • :sort - Sort results
  • :limit - Limit results
  • :offset - Offset results (use with caution in Cassandra)
  • :select - Select specific fields
  • :multitenancy - Keyspace-based multitenancy

Limitations

Since ScyllaDB/Cassandra is a wide-column store, not all SQL features are supported:

  • No JOINs (use denormalization or multiple queries)
  • Limited aggregation support
  • No transactions across partitions (lightweight transactions only)
  • No complex WHERE clauses on non-primary key columns without secondary indexes

Summary

Types

t()

@type t() :: %AshScylla.DataLayer{
  filters: list(),
  limit: pos_integer() | nil,
  offset: pos_integer() | nil,
  repo: module() | nil,
  resource: Ash.Resource.t(),
  select: [atom()] | nil,
  sorts: list(),
  table: String.t() | nil,
  tenant: term()
}