A professional web-based SQL editor built with Streamlit and Supabase, designed for interactive SQL learning and practice.
- 💻 Interactive SQL editor with syntax highlighting
- ⚡ Real-time query validation and execution
- 📝 Immediate feedback on query correctness
- 📚 Question bank with practice problems
- 🛡️ Secure query execution environment
- 🎨 Professional user interface with modern styling
- 📝 Professional SQL editor with syntax highlighting
- 📊 Question selector dropdown
- ⌨️ Query input text area
- 🎯 Test and Submit buttons
- 📈 Result display area
- 🎨 Custom CSS styling for modern appearance
🔄 Query Processing
- 🔍
compare_query_results(): Compares user's query results with solutions - 🛡️
is_safe_query(): Security validation for potentially harmful queries - 🎨
highlight_sql(): SQL syntax highlighting - 📋
normalize_query(): Query standardization for comparison - ⚡
execute_query(): Secure query execution through Supabase - ✅
is_query_correct(): Solution verification - 📚
fetch_questions(): Question retrieval from database
🔒 Security Features
- 🛡️ Comprehensive query validation
- 👤 User-specific view creation
- 🔐 Safe query execution via RPC calls
- ⚔️ Prevention of harmful operations
📡 Session Management
- 🔑 Unique user ID generation
- 📝 Query history tracking
- 💾 State persistence during session
- 🌐 Streamlit: Web interface framework
- 📊 Supabase: Database operations
- 🐼 Pandas: Data manipulation and comparison
- 🔑 UUID: User identification
- Clone the repository
- Install dependencies:
pip install streamlit supabase pandas uuid- Configure Supabase:
- Create a Supabase project
- Replace
urlandkeywith your Supabase credentials - Set up your database schema
- 📝 Select a practice question from the dropdown
- ⌨️ Write your SQL query in the editor
- 🔍 Test the query to see immediate results
- ✅ Submit your final answer
- 📊 Review feedback and explanations
- 🔄 Comprehensive try-catch implementation
- 💬 User-friendly error messages
- 🛟 Graceful failure handling
- ✅ Multi-level data validation
- 🖌️ Custom CSS for modern interface
- 📱 Responsive design elements
- 🎭 Professional color scheme
- 📝 Enhanced typography
- 🔘 Interactive button states
- 📊 Clean table formatting
- 🏫 Safe environment for SQL practice
- ⚡ Immediate feedback system
- 💼 Professional development interface
- 📖 Structured learning approach
- 🔄 Interactive query testing
Contributions are welcome! Please feel free to submit a Pull Request.
Remember to update the Supabase credentials (url & key) and implement your own database structure before deploying.
- ⚡ Query execution time < 2s
- 🔄 Real-time syntax highlighting
- 📦 Minimal memory footprint
- 🚀 Fast page load times
