Skip to content

DESCRIBE

DESCRIBE lists any concept registered in the DeReg and returns its definition — including DDL, field types, relationships, and metadata.

DESCRIBE is a structural introspection command: it shows how a concept is defined, not how it behaves at runtime.

In an interactive DeQL session, you often need quick answers to questions like:

  • What fields does this command expect?
  • What aggregate does this decision target?
  • What is the STATE AS query inside a decision?
  • What events does this projection consume?

DESCRIBE provides these answers directly in the SQL console, without evaluating decisions, replaying events, or executing projections.

DESCRIBE <ConceptType> <Name>;

Where <ConceptType> is one of: AGGREGATE, COMMAND, EVENT, DECISION, PROJECTION, EVENTSTORE, TEMPLATE.

deql> DESCRIBE AGGREGATE BankAccount;
Aggregate: BankAccount
Events: AccountOpened, Deposited
Decisions: Open, DepositFunds
Projection: AccountBalance
deql> DESCRIBE COMMAND OpenAccount;
Command: OpenAccount
Fields:
account_id UUID
initial_balance DECIMAL(12,2)
Decision: Open
Aggregate: BankAccount
deql> DESCRIBE EVENT AccountOpened;
Event: AccountOpened
Fields:
initial_balance DECIMAL(12,2)
Emitted by: Open (decision)
Aggregate: BankAccount
deql> DESCRIBE DECISION DepositFunds;
Decision: DepositFunds
Aggregate: BankAccount
Command: Deposit
State:
SELECT initial_balance AS balance
FROM DeReg."BankAccount$Agg"
WHERE aggregate_id = :account_id
Emit:
SELECT EVENT Deposited (
amount := :amount
)
WHERE balance >= :amount
Guard: balance >= :amount
deql> DESCRIBE PROJECTION AccountBalance;
Projection: AccountBalance
Source: DeReg."BankAccount$Events"
Fields:
aggregate_id UUID
balance DECIMAL(12,2)
Query:
SELECT
stream_id AS aggregate_id,
LAST(data.initial_balance) AS balance
FROM DeReg."BankAccount$Events"
GROUP BY stream_id
deql> DESCRIBE EVENTSTORE local_dev;
EventStore: local_dev
Durable: parquet (/tmp/deql/)
Immutable: true
deql> DESCRIBE TEMPLATE wallet_aggregate;
Template: wallet_aggregate
Parameters:
wallet_name STRING
currency STRING
Produces:
AGGREGATE {{wallet_name}}Wallet
COMMANDS TopUp{{wallet_name}}, Debit{{wallet_name}}
EVENTS {{wallet_name}}WalletToppedUp, {{wallet_name}}WalletDebited
DECISIONS TopUp{{wallet_name}}, Debit{{wallet_name}}
PROJECTION {{wallet_name}}WalletBalance
Instances:
Main (wallet_name = 'Main', currency = 'USD')
Promo (wallet_name = 'Promo', currency = 'USD')

Use DESCRIBE without a name to list all registered concepts of a type:

deql> DESCRIBE AGGREGATES;
Aggregate | Decisions | Events | Projection
----------------|-----------|--------|-------------------
Employee | 2 | 2 | EmployeeRoster
BankAccount | 2 | 2 | AccountBalance
deql> DESCRIBE COMMANDS;
Command | Aggregate | Decision
---------------------|-----------------|------------------
HireEmployee | Employee | Hire
PromoteEmployee | Employee | Promote
OpenAccount | BankAccount | Open
Deposit | BankAccount | DepositFunds
deql> DESCRIBE DECISIONS;
Decision | Aggregate | Command | Guard
---------------------|-----------------|------------------|------------------
Hire | Employee | HireEmployee | (none)
Promote | Employee | PromoteEmployee | (none)
Open | BankAccount | OpenAccount | (none)
DepositFunds | BankAccount | Deposit | balance >= :amount

Cross-reference all registered concepts for consistency. This checks that every command has a matching decision, every event is emitted by at least one decision, and all aggregate references resolve:

VALIDATE DEREG;

Dump the entire Decision Registry as reproducible DeQL statements. Useful for backup, migration, or sharing a complete system definition:

EXPORT DEREG;

For programmatic access, the DeReg metadata can optionally be exposed as queryable tables:

SELECT * FROM DeReg.meta_aggregates;
SELECT * FROM DeReg.meta_commands;
SELECT * FROM DeReg.meta_events;
SELECT * FROM DeReg.meta_decisions;
SELECT * FROM DeReg.meta_projections;
SELECT * FROM DeReg.meta_eventstores;
SELECT * FROM DeReg.meta_templates;

These are read-only tables populated from the DeReg on startup. They support standard SQL — filtering, joining, exporting:

-- Find all decisions that read from more than one aggregate
SELECT name, aggregate, state_query
FROM DeReg.meta_decisions
WHERE state_query LIKE '%JOIN%';
-- Find all events not consumed by any projection
SELECT e.name
FROM DeReg.meta_events e
LEFT JOIN DeReg.meta_projections p ON p.event_types LIKE '%' || e.name || '%'
WHERE p.name IS NULL;

With DESCRIBE, VALIDATE DEREG, and EXPORT DEREG, the complete set of DeQL keywords is:

KeywordPurpose
CREATEDefine aggregates, commands, events, decisions, projections, eventstores, templates
CREATE OR REPLACEOverwrite existing definitions for aggregates, commands, events
APPLY / USEInstantiate a template
EXECUTESend a command, trigger a decision, get events back
INSPECTSimulate decisions or projections side-effect-free
DESCRIBEInspect any concept’s definition and metadata
VALIDATE DEREGCross-reference consistency check across all registered concepts
EXPORT DEREGDump the Decision Registry as reproducible DeQL
SELECTQuery projections, event streams, aggregate state, meta tables