list_databasesLABSCO SUMMARY
`pretensor analyze` is the part that makes the graph more than a schema dump.
It scans a repository for SQL string literals in Python, resolves the tables each statement touches, and links the code to the graph — so consumers can name the service and file that read a table, and impact carries that provenance with it. Notably, raw SQL text is never stored, only a fingerprint. Two things to check before adopting: install the driver extra for your database or the index step fails at connect time, and the project is Beta with tool names and graph schema still allowed to move between minor versions.
What it is
A schema knowledge base for PostgreSQL, Snowflake and BigQuery. It introspects the database, builds a graph of tables, columns, foreign keys and inferred joins, and serves that graph to an agent — so schema questions are answered from the graph rather than from raw SQL against your warehouse.
What you get
list_databasesshows indexed connections with table counts and staleness,schemashows node labels and edge typesqueryruns BM25 keyword search over table and entity metadata, upgrading to a hybrid BM25 + cosine rerank when embeddings are installedsemantic_searchranks tables by cosine similarity, and returns a structured BM25-fallback envelope when the embeddings extra is absentcontextreturns everything about one table — columns, joins, lineage, cluster metadata — andtraversefinds join paths between two tablesimpactlists downstream tables reachable by foreign key and inferred-join edges, each carrying its external code consumersconsumersnames the service, file, line range, read/write op and confidence for code that touches a table, populated bypretensor analyzecypherruns read-only queries against the graph; mutating clauses are rejecteddetect_changescompares the live schema against the last indexed snapshot without mutating the graphcompile_metriccompiles semantic-layer YAML into validated SQL, andvalidate_sqlchecks SQL against the graph before you execute it
Requirements
Python 3.11 or 3.12. Published on PyPI as pretensor version 0.1.0. Database drivers are extras, not part of the base install — pip install 'pretensor[postgres]', [snowflake], [bigquery], or [all-connectors]; a bare install has no driver and fails at connect time. [embeddings] adds local ONNX embeddings and is what turns semantic_search from a fallback into real cosine ranking; [clustering] adds Leiden community detection. Usage is pretensor index against your database URL, then pretensor serve --config-only, which prints the client JSON to merge into your settings. --state-dir and --graph-dir override the default .pretensor directory. It is marked Beta, and the advice is to pin exact versions until 1.0.0.
Setup effort
Follow the published steps — pip install 'pretensor[postgres]'
USE CASES
Asking an agent about a warehouse it has never seen
Let it search the graph for the relevant tables instead of pasting DDL into the prompt.
Working out how two tables join
Ask for the join path rather than guessing from column names.
Checking what breaks if you change a table
List downstream tables and the services that read them, with file and line.
Catching schema drift
Compare the live database against the last index without touching the graph.
Sanity-checking generated SQL
Validate it against the indexed graph before running it against the warehouse.
12 tools
Listed in project docs. Your client may show a different list.
schemaquerysemantic_searchcyphercontexttraverseimpactconsumersdetect_changescompile_metricvalidate_sqlBEFORE YOU INSTALL
What to know first
Tools you get
12 tools named in the project's documentation. semantic_search always appears but falls back to BM25 ranking unless pretensor[embeddings] is installed and tables carry vectors.
Requires
Python 3.11 or 3.12 (3.13 not yet tested)
Where it runs
Both documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
# Indexing PostgreSQL? Install the postgres extra:
pip install 'pretensor[postgres]'
# or, inside a uv-managed environment:
uv pip install 'pretensor[postgres]'
pretensor index postgresql://<YOUR_DB_USER>:<YOUR_DB_PASSWORD>@<YOUR_DB_HOST>:5432/<YOUR_DB_NAME>
pretensor serve --config-only # prints mcpServers JSON for Claude / CursorMCP Clients
Claude Desktop, Cursor
{
"mcpServers": {
"pretensor": {
"command": "pretensor",
"args": [
"serve",
"--graph-dir",
"<YOUR_PATH_TO_PRETENSOR>"
]
}
}
}