(Supabase, Neon, Aiven, AWS… doesn’t matter)
The Problem
Databases scattered across providers. Different engines. Different tables.
Users don’t care. They just want an answer. GPT needs to know where to go.
The Setup (my stack)
- FastAPI connector — takes SQL, routes to right DB, handles auth.
- Function calling schema — OpenAPI JSON so GPT knows where to send queries.
- YAML semantic layer — schema, sample rows, rules, golden queries.
- Custom instructions — routing rules + answer format.
How it Runs
1. User asks.
2. GPT picks DB + builds SQL.
3. Query sent to FastAPI.
4. FastAPI checks auth → DB runs query.
5. DB → FastAPI → JSON → GPT replies.
Try It Live
https://chatgpt.com/share/68ca3b99-724c-800f-b303-8374ed94ba6d
Works across Supabase (ODI cricket), Neon (T20 cricket), Aiven (Tour de France). ~2.5M rows, 340MB data, 7.5k matches across past ~22 years + 122 years of Tour history.
Security
IT world has been doing it for decades — API keys, read-only roles, rate limits, role based access, row level security etc. Nothing new. Setup as per your requirements. GPT is just another frontend (OAuth enabled by the way)
Source + Docs
Docs: app.tigzig.com/cricket-tour-de-france-gpt
Repo: https://github.com/amararun/shared-fastapi-fixed-databases/
Data :https://drive.google.com/drive/folders/1QlE8tJDKAX9XaHUCabfflPgRnNiOXigV?usp=drive_link
