What do you want to do?
5 use cases
-
Select tables for one role on your own database
Run schema selection against a real Postgres database as a named principal and get the prompt fragment for that role.
- REPO
ashishsinha1602/schemagate - Data and analytics
- Intermediate
View prompt
Install schemagate with the postgres extra, then run `schemagate select "revenue by month" --url <postgres-url> --principal okta:jdoe --role finance`. Return the selected table names and state whether any table is one the finance role should not read.
- REPO
-
Gate the schema inside a SQL agent's Python code
Load a catalog, restrict a table to one role, and pass only the selected schema fragment into your agent prompt.
View prompt
Using the schemagate Python API, bootstrap a Catalog from <database-url>, restrict the table <restricted-table> to the role <role>, and select tables for the question <question> for a Principal with that role. Return sel.prompt_fragment() and confirm the restricted table name does not appear in it.
-
Measure how many prompt tokens selection saves
Compare the DDL a model gets with and without Schemagate for one question on the bundled schema.
View prompt
Install schemagate, then run `schemagate demo "late shipments by carrier" --prompt` and `schemagate demo "which customers owe us money"`. Report the number of selected objects and the approximate prompt token count for each, and state the total object count of the bundled schema.
-
Tune table hints in the Studio page
Open the local Studio page, try questions, and add hints to steer selection toward the right tables.
- REPO
ashishsinha1602/schemagate - Data and analytics
- Intermediate
View prompt
Run `schemagate studio --url <postgres-url>`, ask the question <question>, add a hint to the table <table-name>, and re-run the question. Report which tables were selected before and after the hint and whether the target table now appears.
- REPO
Quick start with Schemagate
- Check you have what it needs: Python and pip installed; For your own database: a reachable Postgres, Oracle, MySQL or SQL Server URL, and the matching schemagate extra; Optional: a model key only if you want generated answers or AI descriptions.
- Open ashishsinha1602/schemagate on GitHub and read the README and license.
- Run
pip install schemagateto install the library. - Run
schemagate demo "salary by employee"and confirm hr_compensation is absent from the result. - Run
schemagate demo "salary by employee" --principal okta:hr --role payrolland confirm the table now appears first. - Run
schemagate demo "salary by employee" --promptif you want to read the DDL the model would receive. (inferred, check the README)
These steps come from our top use case, See which tables a caller is blocked from, which also has a copy-paste agent prompt.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for ashishsinha1602/schemagate
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeSchemagate alternatives · Best AI repos for Data and analytics
About this repo
- Who it is forData engineers and developers building text-to-SQL agents who need the model to see only the tables each user is allowed to read.
- Why it is hot105 stars, launched 48 days ago
- LanguagePython
- Sourcegithub.com/ashishsinha1602/schemagate · Back to Hot repos
Requirements
- Python and pip installed
- For your own database: a reachable Postgres, Oracle, MySQL or SQL Server URL, and the matching schemagate extra
- Optional: a model key only if you want generated answers or AI descriptions
Add this badge to your README
Maintain Schemagate? Show readers where to find these use cases.
Markdown
[](https://dedupedai.com/use-cases/ashishsinha1602-schemagate/?utm_source=github&utm_medium=badge&utm_campaign=ashishsinha1602-schemagate)
HTML
<a href="https://dedupedai.com/use-cases/ashishsinha1602-schemagate/?utm_source=github&utm_medium=badge&utm_campaign=ashishsinha1602-schemagate"><img src="https://dedupedai.com/badge/ashishsinha1602/schemagate.svg" alt="Use cases on Deduped" height="20"></a>
A static image, no tracking script. About the badge
Questions about Schemagate
What is Schemagate?
schemagate is a Python library and local studio page that filters a text-to-SQL schema by the caller's grants, so restricted tables never reach the LLM prompt. It is an open-source project on GitHub: https://github.com/ashishsinha1602/schemagate.
Who is Schemagate for?
Data engineers and developers building text-to-SQL agents who need the model to see only the tables each user is allowed to read.
What can I do with Schemagate?
5 use cases so far, for example: See which tables a caller is blocked from; Select tables for one role on your own database; Gate the schema inside a SQL agent's Python code. Each has steps and a copy-paste agent prompt.
What do I need to run Schemagate?
Python and pip installed; For your own database: a reachable Postgres, Oracle, MySQL or SQL Server URL, and the matching schemagate extra; Optional: a model key only if you want generated answers or AI descriptions.
What are alternatives to Schemagate?
Other hot AI repos in Data and analytics: DSH Usage, Asobeast, Coreclaw API Directory, Quail, Nexus Pilot.
Is Schemagate safe to run?
Deduped does not own, audit or vouch for it. Read the README and license, run it on your own systems first and review every command before you run it.