SELECT or WITH. Start from a template, or paste your own statement. That rule does not change.
Start a query
Click New query to open a blank editor. Set the toolbar date range for the period you care about, then paste aSELECT or WITH and click Run.

Accepted SQL queries
Insights accepts one read-onlySELECT or WITH statement against the data lake. The dialect is DuckDB SQL.
DuckDB functions such as TRY_CAST, DATE_TRUNC, ANY_VALUE, and BOOL_AND are available. PostgreSQL-only or MySQL-only syntax is not guaranteed to run. Any other statement is rejected.
The toolbar date range chooses which days are scanned. A
WHERE clause can drop rows inside those days. It cannot open days outside the range.
Open Schema for tables and how they connect. Open Data Lake for how history is stored.
Save a query
After you run a query you want to keep, click Save. Until you save, the draft is named Untitled lake query. Saved queries live on this instance. Open one from Saved to put that SQL back in the editor.
Schedule a query
Schedule query appears in Actions once the query is saved with no unsaved edits.- Open Actions → Schedule query.
- Pick a Preset (Hourly, Daily at 09:00, Weekly on Monday, or Monthly on the 1st). The Cron expression field fills from the preset. You can leave it as is unless you need a custom schedule.
- Confirm Timezone, then click Save schedule.
- Schedules always run the last saved version. Editor changes do not run until you save again.
- A scheduled report is the same SQL you run by hand. If a run returns empty, check the date range first.

Reopen a past run
Use History when you want to reopen SQL you already ran on this instance, including queries you never saved. Saved is a different list: it stores the query you chose to keep, while History stores each execution.
Troubleshooting
My totals do not match the dashboard
My totals do not match the dashboard
Check whether the query sums
precise_amount as-is, or divides by precision first. See Precision.Also check whether it mixed currencies, or summed balances.balance across days. For live data, use the Ledger API.Transaction counts look inflated after a join
Transaction counts look inflated after a join
Check whether
balances, ledgers, or identity were collapsed to one row per ID before the join. See How they connect.Open inflight holds look wrong
Open inflight holds look wrong
Check the toolbar date range covers both the hold and its commit or void days. You can also reference the Open inflight holds template.
Query returns no rows
Query returns no rows
Check the toolbar date range. It has to include the days you expect to see.
Query fails with a type error
Query fails with a type error
A column may be typed differently across days of history. Check whether dates and amounts are wrapped in
TRY_CAST.Query rejected: statement not allowed
Query rejected: statement not allowed
Check that the statement is one
SELECT or WITH. See Accepted SQL queries.Query is slow or times out
Query is slow or times out
Check the toolbar date range, how many currencies you are scanning, whether you selected
*, and whether the query has a LIMIT (recommended to keep it under 5000).