Datashare syncs are billed based on bytes transferred and byte-months of storage for the synced table.
How It Works
- dbt builds a
tableorincrementalmodel in your Dune namespace. - A dbt post-hook runs
ALTER TABLE ... EXECUTE datashare(...)on that table. - Dune registers or updates the datashare sync and sends the data to your configured target.
- You monitor the sync in
dune.datashare.table_syncsanddune.datashare.table_sync_runs.
Prerequisites
- Enterprise account with Data Transformations enabled
- Datashare configured for your team by Dune
- Dune API key with write access
- A dbt project using the Dune Trino connector
Recommended Starting Point
The fastest way to get started is the public template repo:dune-dbt-template
Includes the datashare macro, a prod-only post-hook, and an opt-in example model.
Add The dbt Post-Hook
Add the datashare post-hook to yourdbt_project.yml:
prod target. Temporary dev or CI schemas should not create datashare syncs by default.
Configure A Model
Enable datashare inmeta.datashare on a table or incremental model:
Configuration Fields
| Field | Required | Description |
|---|---|---|
enabled | Yes | Must be true to trigger a sync. |
time_column | Yes | Column used by the sync window. |
time_start | Yes | SQL expression for the start of the window. |
time_end | No | SQL expression for the end of the window. Defaults to now(). |
unique_key_columns | No | Unique row identity columns. Falls back to the model unique_key. |
time_column, time_start, and time_end at the same granularity. For example, if time_column is a date, use date-based expressions rather than hour-based timestamp windows.
Full Refresh Behavior
The sync usesfull_refresh = true when:
- the model is materialized as a
table - the incremental model is running for the first time
- the model is run with
--full-refresh
full_refresh = false.
Manual Syncs
You can trigger a sync manually withdbt run-operation:
dbt run.
Monitor Syncs
table_syncs for the current registration state and table_sync_runs for execution history.