llama-index-retrievers-schemagate
A LlamaIndex retriever for text-to-SQL. Each question gets only the tables it needs, picked from the tables the caller may read. A table the caller can't read is never a candidate, so it can't reach the prompt.
pip install llama-index-retrievers-schemagate
from schemagate import Catalog, Principal
from llama_index.retrievers.schemagate import SchemagateRetriever, prompt_fragment
cat = Catalog().bootstrap("postgresql://localhost/app")
retriever = SchemagateRetriever(cat, top_k=6, principal=Principal("okta:jdoe", roles={"finance"}))
nodes = retriever.retrieve("revenue by month") # one node of DDL per selected table
schema_for_prompt = prompt_fragment(nodes)
Selection runs offline (BM25 plus a small embedder) and calls no model. aretrieve works too.
On Spider 2.0's public BigQuery and Snowflake schemas, the median database with 50+ tables went from the full schema to a selection 92.9% smaller, in prompt tokens. On small databases there is little to cut: 8.8% on BIRD's seven-table ones. The script and the recall trade-off are in schemagate's BENCHMARKS.md.
The retriever itself is maintained in schemagate, which also has the guide: docs/llamaindex.md.
Apache-2.0.
Metadata
Release files for llama-index-retrievers-schemagate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_retrievers_schemagate-0.1.0.tar.gz | 7.1 kB | With provenance | Details for llama_index_retrievers_schemagate-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_retrievers_schemagate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_retrievers_schemagate-0.1.0-py3-none-any.whl |
Total release size: 13.9 kB
Release files / llama_index_retrievers_schemagate-0.1.0.tar.gz
| Download URL | llama_index_retrievers_schemagate-0.1.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ea26ddb037e8f4679b95dbb167396e6c3662ec861009e9996fb891b09427f43
|
|
BLAKE2b-256 checksum How to use checksums |
12cfeed7ef32e32fe58fa31a93c837ce1fff024b9b682965a5e4de22ab6dfaa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / llama_index_retrievers_schemagate-0.1.0-py3-none-any.whl
| Download URL | llama_index_retrievers_schemagate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed46b769f3f695ba99e41af6bee88b07adcf884a16d30ae7bc5fc80e97501688
|
|
BLAKE2b-256 checksum How to use checksums |
fea19a762013394ae45926b3ff72a941a1608412ad46105212eebb1dfe9b1cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for llama-index-retrievers-schemagate 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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for llama_index_retrievers_schemagate-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA 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.