{
 "schema_version": 1,
 "generated": "2026-10-24",
 "id": "ashishsinha1602-schemagate--select-tables-for-a-role-on-your-database",
 "repo": "ashishsinha1602/schemagate",
 "repo_url": "https://github.com/ashishsinha1602/schemagate",
 "repo_slug": "ashishsinha1602-schemagate",
 "title": "Select tables for one role on your own database",
 "page_title": "How to select tables for one role on your own database with Schemagate",
 "summary": "Run schema selection against a real Postgres database as a named principal and get the prompt fragment for that role.",
 "who": "A data team lead who wants to confirm that a finance user's text-to-SQL prompt only includes tables that user may read.",
 "problem": "Without identity-aware selection, a finance question can pull in tables outside finance access, and row-level security then hides every row without telling the user why.",
 "outcome": "You get the list of tables selected for the finance role on your database, with the prompt sized to those tables only.",
 "steps": [
  "Run `pip install 'schemagate[postgres]'` to add the Postgres driver.",
  "Run `schemagate select \"revenue by month\" --url postgresql://localhost/app --principal okta:jdoe --role finance` against your database.",
  "Check that every table in the output is one the finance role is allowed to read.",
  "Run the same command with a different `--role` value and compare the table lists."
 ],
 "agent_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.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The result is only as accurate as the grants Schemagate can see in your database and the roles you pass in, so check the output against your actual access rules.",
 "category": "Data and analytics",
 "tags": [
  "Data and analytics"
 ],
 "lang": "python",
 "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/ashishsinha1602-schemagate/select-tables-for-a-role-on-your-database/",
 "md": "https://dedupedai.com/use-cases/ashishsinha1602-schemagate/select-tables-for-a-role-on-your-database/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/ashishsinha1602-schemagate--select-tables-for-a-role-on-your-database.json",
 "api_version": "v1"
}
