SchemaGate filters database schema by caller identity before SQL is generated

SchemaGate is an open-source tool that applies role-based access control to text-to-SQL pipelines by filtering database schema objects before they reach the AI model, rather than after a query is written. Depending on the caller's assigned roles, only permitted tables and objects are included in the model's prompt, reducing token usage and preventing exposure of sensitive schema elements. For example, a caller without payroll roles sees 9 of 42 objects and 570 prompt tokens, while a payroll-role holder sees the full relevant schema including compensation tables. The library supports SQLite, PostgreSQL, Oracle, SQL Server, and MySQL, and integrates with LangChain, an MCP server, and a CLI. Benchmarks show gold table recall of 82.6% at top 10 on Spider and 64.0% on Spider 2.0-lite, with full methodology published in the project's BENCHMARKS.md on GitHub under Apache-2.0.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in