Spark resource extension marking a host AshArcadic.DataLayer graph resource
as a replicant CDC mirror target — declares which Postgres {schema, table} this resource mirrors.
Add it to a host graph resource:
use Ash.Resource,
domain: MyApp.Domain,
data_layer: AshArcadic.DataLayer,
extensions: [AshArcadic.Replicant]
replicant do
source_table "orders"
tenant_attribute :org_id
skip [:internal_notes]
endDiverges from the sibling ash_replicant's AshReplicant.Resource (its
resource.ex is the design template — same %Spark.Dsl.Section{} +
use Spark.Dsl.Extension idiom) in these deliberate ways:
source_tableis required, with no reflection fallback — a graph resource's ownarcade do label ... endis NOT its Postgres source table, so the mapping must be declared explicitly.source_schemadefaults to the static string"public"(no reflection).on_truncatesupports only:halt(default, fail-closed) and:mirror— the precedent's SCD2-only:closevalue is dropped (no SCD2 target-side support this slice).- Only
source_schema,source_table,tenant_attribute,skip, andon_truncateare exposed.tenant_mfa,sensitive,upsert_identity,history_*, andon_schema_changeare out of scope — sensitive classification is handled target-side by the existingarcade do sensitive ... endsection, not a replicant-section list. skiphere names source (Postgres) columns excluded from the mirror write — distinct fromarcade do skip ... end, which names target (ArcadeDB) graph attributes.
replicant
Marks a host graph resource as a replicant CDC mirror target and declares its Postgres source mapping and per-resource policies.
Options
| Name | Type | Default | Docs |
|---|---|---|---|
source_table | String.t | Source Postgres table name. Required — a graph resource's own arcade label is not its Postgres source table, so no reflection fallback is offered. | |
source_schema | String.t | "public" | Source Postgres schema name. |
tenant_attribute | atom | Source column carrying the tenant. Resolved per row and passed as tenant: to the mirror action. Requires the source table to be REPLICA IDENTITY FULL: a :delete / PK-changing :update resolves the tenant from old_record, which is key-only under the default replica identity — the tenant column would be absent, so the apply fails closed :tenant_required and halts the whole transaction. | |
skip | atom | list(atom) | [] | Source non-identity columns excluded from the mirror write. Must NOT name the primary key — a dropped PK would forge a fresh vertex identity on every apply, so a skipped PK is rejected at compile by ValidatePrimaryKeyNotSkipped. |
on_truncate | :halt | :mirror | :halt | Policy for an upstream TRUNCATE: :halt (fail-closed, default) or :mirror (raw-delete the mirror rows in-txn). |