A full-stack web application for converting SQL statements between different database dialects using AI-powered conversion.
- Multi-Format Input: Upload SQL from PDF, SQL files, or Excel spreadsheets
- Manual Input: Paste SQL directly with syntax highlighting
- AI-Powered Conversion: Convert between 11+ database dialects using OpenRouter API
- Multiple Export Formats: Download results as PDF, Word, Excel, or SQL files
- Real-time Progress: Live conversion tracking with progress indicators
- MySQL
- PostgreSQL
- Oracle
- SQL Server
- SQLite
- MariaDB
- Teradata
- Snowflake
- BigQuery
- Amazon Redshift
- IBM DB2
- Premium Dark Theme: Modern, beautiful UI with gradient effects
- Drag & Drop: Easy file upload with visual feedback
- Syntax Highlighting: Color-coded SQL for better readability
- Responsive Design: Works seamlessly on desktop, tablet, and mobile
- Smooth Animations: Polished micro-interactions and transitions
- Framework: React 18 with Vite
- Styling: Custom CSS with premium dark theme
- State Management: React Hooks
- HTTP Client: Axios
- UI Components: Custom components with React Icons
- Syntax Highlighting: Prism.js
- Framework: FastAPI (Python)
- AI Integration: OpenRouter API (Gemini, GPT-4, Claude, etc.)
- File Parsing: pdfplumber, openpyxl, sqlparse
- Document Generation: ReportLab, python-docx
- API Documentation: Auto-generated Swagger/ReDoc
- Node.js 16+ and npm
- Python 3.8+
- OpenRouter API Key (get from openrouter.ai)
git clone <repository-url>
cd "Where Clause Conversion Tool"# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
copy .env.example .env # Windows
# OR
cp .env.example .env # Linux/Mac
# Edit .env and add your OpenRouter API key
# GEMINI_API_KEY=your_openrouter_api_key_here
# Run the backend server
python main.pyBackend will be running at http://localhost:8000
# Open a new terminal
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Run the development server
npm run devFrontend will be running at http://localhost:3000
Open your browser and navigate to:
- Frontend: http://localhost:3000
- Backend API Docs: http://localhost:8000/docs
Where Clause Conversion Tool/
βββ backend/ # FastAPI backend
β βββ main.py # Main FastAPI application
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment template
β βββ README.md # Backend documentation
β
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # React components
β β βββ services/ # API service layer
β β βββ App.jsx # Main app component
β β βββ main.jsx # Entry point
β βββ package.json # Node dependencies
β βββ vite.config.js # Vite configuration
β βββ README.md # Frontend documentation
β
βββ converters/ # AI conversion logic
β βββ ai_converter.py # OpenRouter integration
β
βββ parsers/ # File parsing modules
β βββ pdf_parser.py # PDF parsing
β βββ sql_parser.py # SQL file parsing
β βββ excel_parser.py # Excel parsing
β
βββ generators/ # Output file generators
β βββ pdf_generator.py # PDF generation
β βββ word_generator.py # Word document generation
β βββ excel_generator.py # Excel generation
β βββ sql_generator.py # SQL file generation
β
βββ utils/ # Utility functions
β βββ sql_utils.py # SQL parsing utilities
β
βββ config.py # Configuration constants
βββ app.py # Original Streamlit app (legacy)
βββ README.md # This file
GEMINI_API_KEY=your_openrouter_api_key_here
HOST=0.0.0.0
PORT=8000
CORS_ORIGINS=http://localhost:3000,http://localhost:5173VITE_API_URL=http://localhost:8000- Upload: Drag and drop a file (PDF, SQL, Excel) or click to browse
- Paste: Enter SQL statements directly in the text area
- API Key: Enter your OpenRouter API key in the sidebar
- Source Dialect: Select the original SQL dialect
- Target Dialect: Select the target SQL dialect
- Click the "π Convert to [Target Dialect]" button
- Watch the progress as statements are converted
- View side-by-side comparison of original and converted SQL
- Check conversion notes and any errors
- See success/error metrics
- Download results in your preferred format:
- π PDF
- π Word Document
- π Excel
- πΎ SQL File
- Visit https://openrouter.ai
- Sign up or log in
- Navigate to the API Keys section
- Create a new API key
- Copy the key and add it to your
.envfile
Note: OpenRouter provides access to multiple AI models including Gemini, GPT-4, Claude, and more. Some models are free to use.
The application follows modern web design principles:
- Premium Aesthetics: Vibrant gradients, smooth animations, glassmorphism
- User-Centric: Intuitive interface with clear visual feedback
- Responsive: Seamless experience across all devices
- Accessible: Semantic HTML, keyboard navigation, ARIA labels
- Performance: Optimized builds, code splitting, lazy loading
# Backend tests
cd backend
pytest
# Frontend tests
cd frontend
npm test# Backend
black .
flake8
# Frontend
npm run lintcd backend
# Backend runs with uvicorn in production
uvicorn main:app --host 0.0.0.0 --port 8000cd frontend
npm run build
# Output will be in dist/ folder
npm run preview # Preview production build- Ensure you're using an OpenRouter API key, not a direct Google Gemini key
- Check for extra quotes or whitespace in the
.envfile - Verify the key is valid at openrouter.ai
- Ensure both backend and frontend are running
- Check that ports 8000 and 3000 are not in use
- Verify CORS settings in the backend
- Ensure all dependencies are installed
- Check Python path includes the project root
- Verify virtual environment is activated
# Backend
pip install --upgrade pip
pip install -r requirements.txt
# Frontend
rm -rf node_modules package-lock.json
npm installThis project is licensed under the MIT License - see the LICENSE file for details.
- OpenRouter for AI model access
- FastAPI for the excellent Python framework
- React and Vite for the modern frontend stack
- Prism.js for syntax highlighting
- All the open-source libraries that made this possible
- User authentication and saved conversions
- Conversion history and favorites
- Batch file processing
- Custom dialect configurations
- Real-time collaboration
- Dark/Light theme toggle
- More AI model options
- Performance analytics
Made with β€οΈ using React, FastAPI, and AI