Getting Started¶
This guide walks through the full dstrack workflow: initializing a store, taking your
first snapshot, and understanding how snapshots and lineage work.
Prerequisites¶
- Python 3.11 or later
- Install the package:
- Verify the installation:
1. Initialize a store¶
dstrack keeps its history in a local store - a .dstrack/ directory, conceptually
similar to git's .git/. Create one at the root of your project:
ℹ Generating local store structure at /path/to/.dstrack.
✔ Finished creating local store: /path/to/.dstrack
This creates:
.dstrack/
├── datasets/ # one directory per tracked dataset
└── .gitignore # ignores the local .cache/ directory
A few things worth knowing:
- The store is discovered by walking up the directory tree from where you run a
command, so you can
trackdatasets from any subdirectory of your project. - Set the
DSTRACK_ROOT_PATHenvironment variable to point at a store elsewhere. - Re-running
initwhere a store already exists fails by design. Pass--allow-existsto turn that into a warning instead:
2. Track a dataset¶
Tracking reads a data file, computes a snapshot, and stores it. Create a small
data.csv to follow along:
Then snapshot it:
ℹ Reading data.csv and computing snapshot...
✔ Snapshot <snapshot-uuid> written (new dataset, dataset <dataset-uuid>).
ℹ Stored at /path/to/.dstrack/datasets/<dataset-uuid>/snapshots/<snapshot-uuid>.json
A snapshot is an immutable record of the dataset's state at that moment. It captures:
- Schema - column names and inferred types, plus an order-independent
schema_hash - Content fingerprint - a SHA-256 hash of the source file
- Per-column statistics - counts, ranges, null rates, and distribution summaries
The dataset name defaults to the file stem (data above); override it with --name.
3. Snapshots and lineage¶
Run track again on the same path and dstrack recognizes the dataset, extending its
lineage rather than starting a new one. The new snapshot points back to the previous one
via its parent_snapshot_id:
If you rename or move a dataset file, the recorded path no longer matches, so dstrack
would start a new lineage. To keep the history connected, continue the existing dataset
explicitly with --dataset-id:
dstrack track allows you to do, simply ask for the help:
Where snapshots live¶
Each snapshot is a JSON file under its dataset's directory:
The store also keeps an append-only log and a HEAD pointer per dataset. .dstrack/ is
plain text and safe to commit alongside your code, giving you a versioned audit trail of
how your datasets evolved.
Benchmarking (optional)¶
dstrack ships a second command, dstrack-benchmark, that generates a synthetic CSV and
measures snapshot-creation performance - handy for understanding overhead on large files:
This command creates a synthetic file in a temporary location to measure performance.
What's next¶
Change detection and drift monitoring - comparing snapshots to surface schema and distribution shifts, and failing CI when data drifts - are planned. See the roadmap for the full picture.