Skip to content

Unified SQL Pushdown

Dana compiles eligible leading stages of a database pipeline into 100% parameterized SQL (SQLite or native PostgreSQL v3.0 wire protocol), streams the intermediate rows into the vectorized 2,048-row columnar VM for complex local stages, and verifies table schemas offline against schema.lock snapshots.

Supported pushdown stages include:

  • Projection & column dropping (select, drop)
  • Parameterized where predicates (known_not_null join simplification)
  • derive expressions including dedupe_by, coarsen, try_parse_date, try_parse_decimal, calendar/DST ops, and bucket CASE expressions
  • SQLite --attach / ?attach= multi-database queries
  • PostgreSQL array decoding and materialized parse/timezone CTEs

Inspecting Pushdown & Provenance (dana explain)

Section titled “Inspecting Pushdown & Provenance (dana explain)”

Run dana explain --dialect sqlite (or postgres) to inspect the exact split between database SQL and the local VM, alongside step-by-step sensitivity provenance:

[SQL PUSHDOWN -> sqlite] (db=Registrar, bind=__dana_pushdown_0, ops=[SourceDB(StudentEnrollment) -> Filter -> Select(...) -> Derive([age_band])])
SELECT "student_id" AS "student_id", "department" AS "department", "term_seq" AS "term_seq",
"age_years" AS "age_years", "grade_points" AS "grade_points",
(CASE WHEN ("age_years" < ?) THEN ? WHEN ("age_years" < ?) THEN ? WHEN ("age_years" < ?) THEN ? ELSE ? END) AS "age_band"
FROM "StudentEnrollment"
WHERE ("active?" AND ("term_year" >= ?))
[LOCAL VM SUFFIX]
Window([rolling_3t_gpa])
Sort([department:Asc, age_band:Asc, term_seq:Asc])
SuppressSmallGroups(min=5, mode=Drop)
HashAggregate([students:CountDistinct, enrollments:Count, avg_gpa:Mean])
[SENSITIVITY PROVENANCE]
ENTER SourceDB(StudentEnrollment): tags=[ferpa, pii]
DROP_COL Select(...): removed tagged cols [student_email:[pii]]
BUCKET Derive(age_band <- age_years): tags=[ferpa], bucketed=true
PROPAGATE Summarize: row_tags=[ferpa, pii]
CLEAR SuppressSmallGroups(min=5, mode=Drop): cleared [ferpa, pii]
OUTPUT: PUBLIC (no sensitivity tags remaining)