Raw table
A raw table holds data exactly as a pipeline loaded it, before any cleanup or business rule changes it. Keeping raw tables lets you rebuild every table downstream after a rule changes, and trace a number back to the rows it came from. ELT pipelines load raw tables first, then transform them in SQL.
In BlockJuice
In BlockJuice a raw table is the warehouse table one source fills, which dbt reads as a source. Its name joins the source’s name and table, as in raw.ethereum_uniswap_v3 or raw.binance_candles. Every raw table has the same three columns: id, the key; data, the record as jsonb; and _loaded_at, when the record was last written.
Records upsert by id, so a rerun replaces a record instead of adding another. Large integers, such as token amounts, go into data as strings, so they keep every digit. Only one run of a source table writes at a time.
Sources only load, and dbt reads each raw table through a staging view. When a rule in a model was wrong, you fix the SQL and rebuild. The raw rows are still there, so you fetch nothing again. The raw schema also holds the dead letters, in raw._dead_letters, and the cursors of the stream sources, in raw._sync.
Example
Each row of raw.ethereum_erc20_transfers is one Transfer log, keyed by its place on the chain, <block>:<logIndex>. This query reads a few fields straight out of data.
select id, data ->> 'token' as token, data ->> 'value' as value, _loaded_at
from raw.ethereum_erc20_transfers
order by _loaded_at desc
limit 10