Skip to main content

Documentation License Python

👻 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 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, lineage_diff.json
sas-ui lineage.db Local 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-sales \
  --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 &macro_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.

Metadata

Release files for wraith-sas-lineage 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wraith-sas-lineage 0.3.0
File Size Uploaded
wraith_sas_lineage-0.3.0.tar.gz 199.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wraith-sas-lineage 0.3.0
File Interpreter ABI Platform
wraith_sas_lineage-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 254.9 kB

Release files / wraith_sas_lineage-0.3.0.tar.gz

Download URL wraith_sas_lineage-0.3.0.tar.gz
Size 199.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c87e11712ab93268ba1ca8dcc14fb4712f6f87aa10f611aca99f0b97bcc1423c
BLAKE2b-256 checksum
How to use checksums
35bc12c6530c9dc64c276fe0c3ecaf7755534180bcc5bf198801b79888866db1
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / wraith_sas_lineage-0.3.0-py3-none-any.whl

Download URL wraith_sas_lineage-0.3.0-py3-none-any.whl
Size 55.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0dd3dc2d3b1720869b15bedead27f8b4036e6885677a2ae21b1fc14f8e6db42c
BLAKE2b-256 checksum
How to use checksums
0068409e48e69e541698152f1bbcdc492d21461adf4c385a3f82f1c5bdf51d85
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page