dodo dodo / dodoc
dodo docs github
dodo / dodoc
standalone compiler
dodoc
compile .do files to SQL. no DuckDB required.

Compile .do files to SQL without installing DuckDB. A single binary, no dependencies, designed for CI/CD pipelines and SQL preview workflows.

what is dodoc?

dodoc is a standalone CLI that reads .do files and outputs the equivalent SQL — the same translation the dodo DuckDB extension performs, but without needing DuckDB at all.

It shares the same core parser as the extension, so every command the extension understands, dodoc understands too.

why use it?

No DuckDB dependency
Useful in environments where you can't install DuckDB — locked-down CI runners, lightweight containers.
Preview SQL before running
Pipe the output to a file, inspect it, then feed it to DuckDB (or another database) only when you're ready.
CI/CD integration
Compile .do files as a build step, validate the SQL, commit the output.
Pipe-friendly
Reads from stdin, writes to stdout, composes with Unix tools.
two tools, one parser

The dodo extension runs inside DuckDB and executes the translated SQL immediately. dodoc runs outside DuckDB and only produces SQL text. Both share the same parser and produce identical SQL for the same input.

installation

install script (macOS / Linux)

The fastest way — detects your platform and downloads the right binary:

bash// one-liner install
 curl -fsSL https://getdodo.dev/install.sh | sh

Installs to /usr/local/bin (or ~/.local/bin if no sudo). Works on macOS (arm64 & x86_64) and Linux (x86_64 & arm64).

homebrew (macOS / Linux)

bash// via homebrew
 brew install codedthinking/tap/dodoc

download pre-built binaries

Pre-built binaries are available on the GitHub Releases page for five platforms:

macOS arm64
Apple Silicon (M1/M2/M3/M4). Download dodoc-macos-arm64.tar.gz.
macOS x86_64
Intel Macs. Download dodoc-macos-x86_64.tar.gz.
Linux x86_64
64-bit Linux (statically linked). Download dodoc-linux-x86_64.tar.gz.
Linux arm64
ARM64 Linux (statically linked). Download dodoc-linux-arm64.tar.gz.
Windows x86_64
64-bit Windows. Download dodoc-windows-x86_64.zip.

After downloading, extract and install:

bash// macOS / Linux
 tar xzf dodoc-macos-arm64.tar.gz
 sudo install dodoc /usr/local/bin/

build from source

Requires git, make, and a C++17 compiler.

bash// clone and build
 git clone --recurse-submodules https://github.com/codedthinking/dodo.git
 cd dodo
 make dodoc
 sudo make dodoc-install

This installs the dodoc binary to /usr/local/bin/.

verify

bash// check it works
 dodoc --help

usage

Read from stdin or file, output SQL to stdout or file. Pipe into DuckDB or save for later.

stdin to stdout

Pipe .do commands directly:

bash// pipe from echo
 echo 'use "data.csv", clear
keep if year >= 2020
generate profit = revenue - cost' | dodoc

compile a file

Pass the .do file as an argument:

bash// file to stdout
 dodoc analysis/clean.do

Write to a file with -o:

bash// file to file
 dodoc analysis/clean.do -o analysis/clean.sql

what the output looks like

Each .do command becomes a CTE, chained in order, with the original command as a comment. This four-line script:

do// analysis/clean.do
use "data.csv", clear
keep if year >= 2020
generate profit = revenue - cost
collapse (mean) profit, by(industry)

compiles to:

sql// dodoc analysis/clean.do
WITH
  -- [source] use "data.csv", clear
  _s0 AS (
    SELECT *
    FROM read_csv('data.csv')
  ),
  -- [source] keep if year >= 2020
  _s1 AS (
    SELECT *
    FROM _s0
    WHERE year >= 2020
  ),
  -- [source] generate profit = revenue - cost
  _s2 AS (
    SELECT *, (revenue - cost) AS profit
    FROM _s1
  ),
  -- [source] collapse (mean) profit, by(industry)
  _s3 AS (
    SELECT industry, AVG(profit) AS profit
    FROM _s2
    GROUP BY industry
  )
SELECT *
FROM _s3;

working with .dta files

When the script reads or writes Stata .dta files, the generated SQL uses DuckDB's .dta reader and writer:

do
use "panel.dta", clear
save "out.dta", replace
sql// compiled (abridged)
WITH
  -- [source] use "panel.dta", clear
  _s0 AS (
    SELECT *
    FROM read_dta('panel.dta')
  )
...
COPY (...) TO 'out.dta';
.dta needs the dta extension

To execute SQL that reads or writes .dta files, DuckDB needs the dta extension installed. dodoc itself compiles fine without it.

annotated output

The --annotate flag adds the original .do command as a SQL comment above each translated statement, making the output easier to read and debug:

bash// annotated SQL output
 dodoc --annotate analysis/clean.do

piping to duckdb

The most common pattern: compile, then execute. Pipe dodoc output directly into DuckDB:

bash// compile and run in one step
 dodoc script.do | duckdb
dodoc vs dodo extension

When piping to DuckDB this way, DuckDB does not need the dodo extension installed — it receives plain SQL. The extension is only needed when you type .do commands directly in the DuckDB REPL.

all flags

FlagDescription
-o, --output FILEWrite SQL to FILE instead of stdout
--annotateEmit original .do command as a SQL comment before each statement
--terminalAlso emit SQL for terminal commands (list, count, etc.)
-h, --helpShow help message