Who it is forA developer building a text-to-SQL agent who needs proof that a restricted table never reaches the model for a given role.
The problemSchema selection often runs before identity is checked, so the model can be handed a table the caller cannot read and then returns a misleading empty answer.
The outcomeYou see a restricted table absent for one caller and ranked first for a caller with the right role, with no database or model key.
What you need first
- 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
Steps
- 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)
Prompt for your agent
Install schemagate with pip, then run `schemagate demo "salary by employee"` and again with `--principal okta:hr --role payroll`. Report which tables appear in each result and confirm hr_compensation is absent for the first caller and present for the second.
Caveat. The demo runs on the bundled 42-object sample schema, so the results show the mechanism but not how your own grants will behave until you run it against your database.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for ashishsinha1602/schemagate and "See which tables a caller is blocked from"
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 freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer