Data mart
A data mart is a set of finished tables on one subject, such as trades, balances or prices, inside a larger warehouse. Someone has already joined, cleaned and named the data, so analysts query the mart instead of the raw rows. A good mart serves many questions, not one.
In BlockJuice
In BlockJuice a mart is a dbt model that holds one kind of fact for every chain and asset it covers, built for many questions, not one. Marts build as tables in the analytics schema, from the SQL in transformation/.
analytics.dex_trades is one. It stacks three intermediate models, one per Uniswap version, and each applies its version’s sign rule before the mart sees a row. Each row says which token the swapper received and which they paid, in base units. analytics.latest_balances stacks one model per chain and keeps each wallet’s latest reading of each asset.
A pipeline is the marts in one folder and everything they read, run as one Dagster job. bj run dex loads the sources dex_trades reads and rebuilds it. An answer’s analysis selects its result from marts, so answers that read the same mart share its rules. The catalog lists every mart table, what one row is and each column.
Example
The mart has already applied each version’s sign rule, so counting Ethereum swaps by Uniswap version takes one short query.
select version, count(*) as swaps
from analytics.dex_trades
where chain = 'ethereum'
group by version
order by version