Skip to main content

soul-schema 🧠

Auto-generate semantic layers for any database using LLMs.

PyPI version License: MIT

Metadata only. No row data ever leaves your infrastructure.

soul-schema connects to your database, reads the schema, samples a few rows for context, and uses an LLM to generate human-readable descriptions for every table and column. Corrections are remembered permanently — the semantic layer gets smarter over time.


Why soul-schema?

Alation / Collibra Unity Catalog soul-schema
Cost $100K+/yr Databricks only Free / OSS
Setup Weeks Days Minutes
Metadata generation Manual Semi-auto Automatic
Learns from corrections ❌ ❌ ✅
Works with any database ✅ ❌ ✅
Air-gapped (local LLM) ❌ ❌ ✅

Install

pip install soul-schema

# With Anthropic support
pip install soul-schema[anthropic]

# With OpenAI support  
pip install soul-schema[openai]

# Everything
pip install soul-schema[all]

Quickstart

# Connect and generate descriptions
soul-schema connect \
  --db "postgresql://user:pass@localhost/mydb" \
  --llm anthropic \
  --key sk-ant-...

# Review and correct
soul-schema review

# Export to dbt
soul-schema export --format dbt

# Export to Vanna training data
soul-schema export --format vanna

# Check status
soul-schema status

Works with any LLM

# Anthropic Claude (recommended)
soul-schema connect --db ... --llm anthropic --key sk-ant-...

# OpenAI
soul-schema connect --db ... --llm openai --key sk-...

# Ollama (fully local, air-gapped)
soul-schema connect --db ... --llm openai-compatible \
  --base-url http://localhost:11434/v1 \
  --model llama3.2

# Google Gemini
soul-schema connect --db ... --llm openai-compatible \
  --key AIza... \
  --base-url https://generativelanguage.googleapis.com/v1beta/openai \
  --model gemini-2.0-flash

How it works

  1. Connect — reads INFORMATION_SCHEMA for table/column metadata
  2. Sample — fetches up to 10 rows per table to help the LLM understand context
  3. Generate — LLM writes descriptions for every table and column
  4. Store — saves to a human-readable markdown file (schema_memory.md)
  5. Learn — corrections are locked and never overwritten by re-generation
  6. Export — outputs dbt YAML, Vanna training data, or portable JSON

Your data stays in your infrastructure. soul-schema never stores or transmits row-level data. The memory file contains only metadata and LLM-generated descriptions.


The memory file

soul-schema stores everything in a plain markdown file — schema_memory.md.

  • Human-readable and editable by hand
  • Version-controllable with git
  • Locked columns (human corrections) are never overwritten
  • Portable — bring it to any tool

Export formats

soul-schema export --format json    # → soul_schema_export.json
soul-schema export --format dbt     # → schema.yml (dbt schema file)
soul-schema export --format vanna   # → Vanna AI training data

Python API

from soul_schema import SchemaConnector, SemanticGenerator, SchemaMemory

connector = SchemaConnector("postgresql://...")
generator = SemanticGenerator(provider="anthropic", api_key="sk-ant-...")
memory = SchemaMemory("./schema_memory.md")

schema = connector.get_full_schema()
for table, data in schema.items():
    result = generator.generate_table(
        table=table,
        columns=data["columns"],
        sample=data["sample"],
        row_count=data["row_count"],
    )
    memory.set_table(table, result["table_description"], result["columns"])

# Correct a description — locked forever
memory.correct("customers", "cust_ltv", "Customer lifetime value in USD")

# Export
print(memory.export_dbt())

Supported databases

Phase 1: PostgreSQL, MySQL, SQLite
Coming soon: BigQuery, Snowflake, Redshift, DuckDB, ClickHouse


License

MIT — free for commercial use.


Related projects

  • soul.py — persistent memory for LLM agents
  • soul-agent — PyPI package with SoulMateClient
  • SoulMate — hosted memory API for enterprise agents

Metadata

Release files for soul-schema 0.1.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 soul-schema 0.1.0
File Size Uploaded Provenance
soul_schema-0.1.0.tar.gz 16.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for soul-schema 0.1.0
File Interpreter ABI Platform
soul_schema-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / soul_schema-0.1.0.tar.gz

Download URL soul_schema-0.1.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e158645f042d652a1061f73ae606fd43b6be5245b108d4d3c2ecddad442e7d79
BLAKE2b-256 checksum
How to use checksums
a5f6a522e3e4eddb69546b188c94211c511aa40f079771746129bd2f3f10e495
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / soul_schema-0.1.0-py3-none-any.whl

Download URL soul_schema-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffe2971d7c33be8dfd02d55e6d780c906cf46fd8dccc8bb86bb6f3146bcfdae2
BLAKE2b-256 checksum
How to use checksums
36ee5d34c6c106ebd121d51d5b2d57d50c2dc4ab6b03a4a6723ec7ba691653e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Security for soul-schema 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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