SAS lineage extraction, schema mapping, and ODCS contract generation for the Ghost Stack.
Project description
👻 wraith-sas-lineage
SAS Lineage Extraction for the Ghost Stack
wraith-sas-lineage extracts data lineage from SAS DI Studio code and verbose execution logs, maps it to Open Data Contract Standard (ODCS) contracts, and serves a local read-only lineage explorer. One JSON artefact connects all three tools.
Designed for large SAS estates running on Unix. Output feeds wraith-modelgen to auto-generate dbt on BigQuery.
Three tools. One seam.
.sas + .log files
│
▼
sas-parse ──► provenance.json
│
▼
sas-map ──► lineage.db + ODCS contracts + gaps report
│
▼
sas-ui ──► localhost:5000
| Command | Input | Output |
|---|---|---|
sas-parse |
.sas files + verbose logs |
provenance.json |
sas-map |
provenance.json |
lineage.db, ODCS YAML contracts, mapping_gaps.json |
sas-ui |
lineage.db |
Read-only lineage explorer |
Install
uv tool install wraith-sas-lineage
Or for development:
git clone https://git.thomaspeoples.com/thomaspeoples/wraith-sas-lineage.git
cd wraith-sas-lineage
uv run poe setup
Quick start
# Parse SAS code + logs
sas-parse \
--code-dir /path/to/sas/code \
--log-dir /path/to/verbose/logs \
--estate acme-risk \
--output provenance.json
# Map to DB + ODCS contracts
sas-map \
--provenance provenance.json \
--db lineage.db \
--contracts-dir contracts/ \
--gaps mapping_gaps.json
# Browse lineage
sas-ui --db lineage.db
# → http://localhost:5000/flags all extraction flags
# → http://localhost:5000/provenance upstream chain for a column
# → http://localhost:5000/lineage downstream to all MARTs
Design principles
Flag-never-drop. Unresolved macros, remote execution blocks, and hand-written code surface as Flag objects with reason, context, and snippet. Nothing is silently discarded.
Log-first macro resolution. SYMBOLGEN/MLOGIC log lines resolve ¯o_var references before falling back to the code literal. Accurate lineage for DI Studio estates requires verbose logs.
Single seam. provenance.json is the only interface between tools. Each tool is independently runnable and testable.
Content-hashed stable IDs. Table, column, job, and lineage chain IDs are SHA-256[:12] of their canonical string. Same estate, same run, same IDs.
Layer vocabulary
| SAS layer | Schema value |
|---|---|
| RAW | RAW |
| ODS (ODP) | ODP |
| STG (CDP) | CDP |
| MART (FDP) | FDP |
Developer quality gate
uv run poe test # pytest (interactive)
uv run poe test-ci # pytest + coverage ≥ 80%
uv run poe lint # ruff check
uv run poe format # ruff format
uv run poe docs-serve # mkdocs at localhost:8000
All commits go through commitizen:
uv run cz commit
Part of the Ghost Stack. Sovereign. Self-hosted. No nonsense.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wraith_sas_lineage-0.2.0.tar.gz.
File metadata
- Download URL: wraith_sas_lineage-0.2.0.tar.gz
- Upload date:
- Size: 149.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9733c1e1ecb45e16108e2475e022ec6c562ae6b51d1aa2291796626e3a46223c
|
|
| MD5 |
a3ffba4a1be03a3a1dea9169c1fba542
|
|
| BLAKE2b-256 |
e7164a4cb6e8ea891649379497207fbda51e8d3088016b483e6e8d1b6b677b20
|
File details
Details for the file wraith_sas_lineage-0.2.0-py3-none-any.whl.
File metadata
- Download URL: wraith_sas_lineage-0.2.0-py3-none-any.whl
- Upload date:
- Size: 46.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eaed9a3dcb1b2e36f4f83267243eebf0a310216deb5eb817c2339947ff715da
|
|
| MD5 |
5a52a374e2f38d94dc1d8d31cb6315fc
|
|
| BLAKE2b-256 |
34b5a4ac16cb72043cd13ed785b018e0562c59581bedcc767573fc19c12f5bd4
|