Skip to main content

SAS lineage extraction, schema mapping, and ODCS contract generation for the Ghost Stack.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wraith_sas_lineage-0.3.0.tar.gz (199.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wraith_sas_lineage-0.3.0-py3-none-any.whl (55.7 kB view details)

Uploaded Python 3

File details

Details for the file wraith_sas_lineage-0.3.0.tar.gz.

File metadata

  • Download URL: wraith_sas_lineage-0.3.0.tar.gz
  • Upload date:
  • Size: 199.2 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

Hashes for wraith_sas_lineage-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c87e11712ab93268ba1ca8dcc14fb4712f6f87aa10f611aca99f0b97bcc1423c
MD5 f4b6eea721781643823e409300671c22
BLAKE2b-256 35bc12c6530c9dc64c276fe0c3ecaf7755534180bcc5bf198801b79888866db1

See more details on using hashes here.

File details

Details for the file wraith_sas_lineage-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: wraith_sas_lineage-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 55.7 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

Hashes for wraith_sas_lineage-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dd3dc2d3b1720869b15bedead27f8b4036e6885677a2ae21b1fc14f8e6db42c
MD5 ab541329bedf446a22158d30eacc7a75
BLAKE2b-256 0068409e48e69e541698152f1bbcdc492d21461adf4c385a3f82f1c5bdf51d85

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page