This is a static documentation page.
For the full interactive experience, click the button above to access the live app.
Connect ChatGPT to Supabase [OLD]
Connect ChatGPT to Supabase for Natural language to SQL, charts, and Python stats
Transform ChatGPT into a powerful data analysis tool with direct Supabase database connectivity. Query data using natural language, generate charts, and perform statistical analysis.
Video Guide
https://www.youtube.com/watch?v=Zx5Noz2sFgA
What This Gpt Does
- Query databases using natural language without writing SQL
- Generate visual charts and graphs from query results
- Perform statistical analysis using Python
- Access real-time data for dynamic analysis
- Handle large datasets efficiently (tested with 1.5M+ records)
- Present results in both table and chart formats
- Run complex analytical tasks like Chi-square tests
How To Use
- Deploy Backend (5 mins)
- Fork and deploy the FastAPI server code to Render/Railway
- Set DATABASE_URL and REX_API_KEY environment variables
- Note down your deployment URL for the next step
- Configure GPT (5 mins)
- Create a new Custom GPT and add instructions
- Enable Code Interpreter for chart generation
- Add the OpenAPI schema with your endpoint details
- Start Analyzing
- Query your data using natural language
- Request visualizations and statistical analysis
- View results in tables and charts
How It Works
Backend Architecture:
- FastAPI server handles communication between ChatGPT and database
- SQL Alchemy for database operations and query execution
- API Key authentication for endpoint security
Integration Components:
- Natural language to SQL translation
- Python-based statistical analysis capabilities
- Chart generation through Code Interpreter
- OpenAPI schema for ChatGPT actions
Data Flow:
- User queries processed by ChatGPT's natural language understanding
- Queries converted to SQL and executed on Supabase
- Results formatted into tables and visualizations
- Statistical analysis performed on query results
Two Main Ways To Connect
- Fixed Connection to a Specific Database
This page demonstrates the fixed connection method, where the GPT is connected to a specific Supabase database.
- Dynamic Connection to Any Database
If you want to connect to any database on the fly, you can use the dynamic connection method.
Check out the Connect to Any Database tool for an example: app.tigzig.com/rex2-gpt
Resources
Complete Source Code:
https://github.com/amararun/supabase-fastapi-sqlachemy-directdb
FastAPI server code with SQL Alchemy integration and deployment instructions
Step-by-Step Video Guide:
https://www.youtube.com/watch?v=Zx5Noz2sFgA
Detailed walkthrough of setup process and demonstration of features
Built On
OpenAI's GPT Platform - This custom GPT transforms ChatGPT into a powerful database analysis tool, enabling natural language interaction with Supabase databases.
Source: tigzig.com | Open source AI tools for analytics, databases & automation | Amar Harolikar