|
| 1 | +# QueryPilot Setup Instructions |
| 2 | + |
| 3 | +Thank you for downloading QueryPilot! Follow these simple steps to get started. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +Before you begin, make sure you have: |
| 8 | + |
| 9 | +- ✅ Windows 10 or higher |
| 10 | +- ✅ MySQL Workbench or pgAdmin 4 installed |
| 11 | +- ✅ An active database (MySQL or PostgreSQL) |
| 12 | +- ✅ Groq API key (free at https://console.groq.com) |
| 13 | +- ✅ Pinecone API key (optional, only if using Pinecone vector store) |
| 14 | + |
| 15 | +## Quick Start (5 minutes) |
| 16 | + |
| 17 | +### Step 1: Configure Environment Variables |
| 18 | + |
| 19 | +1. Locate the file named `.env.example` in this folder |
| 20 | +2. Rename it to `.env` (remove the `.example` extension) |
| 21 | +3. Open `.env` with a text editor (Notepad, VS Code, etc.) |
| 22 | +4. Fill in your credentials: |
| 23 | + |
| 24 | +```env |
| 25 | +GROQ_API_KEY=your_groq_api_key_here |
| 26 | +DB_PASSWORD=your_database_password |
| 27 | +DB_NAME=your_database_name |
| 28 | +PINECONE_API_KEY=your_pinecone_key_here # Only if using Pinecone |
| 29 | +``` |
| 30 | + |
| 31 | +**Where to get API keys:** |
| 32 | +- **Groq API Key**: Sign up at https://console.groq.com (free tier available) |
| 33 | +- **Pinecone API Key**: Sign up at https://www.pinecone.io (only if using Pinecone vector store) |
| 34 | + |
| 35 | +### Step 2: Configure Database Connection |
| 36 | + |
| 37 | +1. Locate the file named `db_config.yaml.example` |
| 38 | +2. Rename it to `db_config.yaml` |
| 39 | +3. Open `db_config.yaml` and verify the settings: |
| 40 | + |
| 41 | +```yaml |
| 42 | +db: |
| 43 | + type: mysql # Change to 'postgres' if using PostgreSQL |
| 44 | + user: root # Your database username |
| 45 | + password: ${DB_PASSWORD} # Uses value from .env |
| 46 | + host: localhost |
| 47 | + port: 3306 # Use 5432 for PostgreSQL |
| 48 | + name: ${DB_NAME} # Uses value from .env |
| 49 | + sample_rows: 2 |
| 50 | +``` |
| 51 | +
|
| 52 | +**Note**: The `${DB_PASSWORD}` and `${DB_NAME}` placeholders will automatically use the values you set in the `.env` file. |
| 53 | + |
| 54 | +### Step 3: Run QueryPilot |
| 55 | + |
| 56 | +1. Double-click `QueryPilot.exe` |
| 57 | +2. You should see: `👀 Listening for Ctrl+C and Tab... (press Esc to quit)` |
| 58 | +3. **Success!** QueryPilot is now running. |
| 59 | + |
| 60 | +## How to Use QueryPilot |
| 61 | + |
| 62 | +### Step 1: Open Your SQL Editor |
| 63 | + |
| 64 | +Open MySQL Workbench or pgAdmin 4 (must be one of these) |
| 65 | + |
| 66 | +### Step 2: Ask Query using comments |
| 67 | + |
| 68 | +Ask your question: |
| 69 | + |
| 70 | +```sql |
| 71 | +-- Fetch me the data for employees having more than 20LPA CTC |
| 72 | +``` |
| 73 | + |
| 74 | +### Step 3: Get AI Suggestions |
| 75 | + |
| 76 | +1. Select your question (comment) |
| 77 | +2. Press **Ctrl+C** to trigger QueryPilot |
| 78 | +3. Wait a moment for the AI suggestion to appear |
| 79 | + |
| 80 | +### Step 4: Accept or Dismiss |
| 81 | + |
| 82 | +- Press **Tab** to accept and insert the suggestion |
| 83 | +- Press any other key to dismiss it |
| 84 | + |
| 85 | +### Other Hotkeys |
| 86 | + |
| 87 | +- **Ctrl+Z**: Remove ghost text |
| 88 | +- **Ctrl+Shift+C**: Clear session memory |
| 89 | +- **Esc**: Quit QueryPilot |
| 90 | + |
| 91 | +## Example Workflow |
| 92 | + |
| 93 | +```sql |
| 94 | +-- 1. Ask your question |
| 95 | +-- Fetch me the data for employees having more than 20LPA CTC |
| 96 | +
|
| 97 | +-- 2. Select the statement and press Ctrl+C |
| 98 | +
|
| 99 | +-- 3. QueryPilot shows suggestion: |
| 100 | +/* suggestion: SELECT * FROM Employees WHERE CTC > 2000000; */ |
| 101 | +
|
| 102 | +-- 4. Press Tab to accept, or any other key to dismiss |
| 103 | +``` |
| 104 | + |
| 105 | +## Configuration (Optional) |
| 106 | + |
| 107 | +You can customize QueryPilot by editing `params.yaml`: |
| 108 | + |
| 109 | +### Change Vector Store |
| 110 | + |
| 111 | +```yaml |
| 112 | +vector_store: |
| 113 | + type: faiss # Options: faiss, pinecone, chromadb |
| 114 | +``` |
| 115 | + |
| 116 | +### Adjust Session Memory |
| 117 | + |
| 118 | +```yaml |
| 119 | +memory: |
| 120 | + enable: true |
| 121 | + limit: 3 # Remember last 3 queries |
| 122 | +``` |
| 123 | + |
| 124 | +### Change Hotkeys |
| 125 | + |
| 126 | +```yaml |
| 127 | +triggers: |
| 128 | + initiater: ctrl+c # Change trigger key |
| 129 | + filler: tab # Change accept key |
| 130 | +``` |
| 131 | + |
| 132 | +## Troubleshooting |
| 133 | + |
| 134 | +### Problem: "Cannot find .env file" |
| 135 | + |
| 136 | +**Solution:** |
| 137 | +- Make sure you renamed `.env.example` to `.env` |
| 138 | +- Ensure `.env` is in the same folder as `QueryPilot.exe` |
| 139 | +- Check that the file extension is `.env` (not `.env.txt`) |
| 140 | + |
| 141 | +### Problem: "Database connection failed" |
| 142 | + |
| 143 | +**Solution:** |
| 144 | +1. Verify your database is running |
| 145 | +2. Check credentials in `.env` file |
| 146 | +3. Make sure the database name exists |
| 147 | +4. Test connection with MySQL Workbench/pgAdmin 4 first |
| 148 | + |
| 149 | +### Problem: "API key invalid" |
| 150 | + |
| 151 | +**Solution:** |
| 152 | +1. Verify your Groq API key at https://console.groq.com |
| 153 | +2. Make sure there are no extra spaces in the `.env` file |
| 154 | +3. Check that you copied the entire key |
| 155 | + |
| 156 | +### Problem: "Vector store not found" |
| 157 | + |
| 158 | +**Solution:** |
| 159 | + |
| 160 | +If you see errors about missing vector store files, you need to prepare the data: |
| 161 | + |
| 162 | +**Option A - Use Pre-built Data (if provided):** |
| 163 | +- Check if `data/processed/` folder exists with vector store files |
| 164 | +- If not, see Option B |
| 165 | + |
| 166 | +**Option B - Build Vector Store Yourself:** |
| 167 | + |
| 168 | +This requires Python 3.8+. In a terminal: |
| 169 | + |
| 170 | +```bash |
| 171 | +# Install Python dependencies |
| 172 | +pip install -r requirements.txt |
| 173 | +
|
| 174 | +# Download SQL dataset |
| 175 | +python src/loading_data.py --config params.yaml |
| 176 | +
|
| 177 | +# Build vector store |
| 178 | +python src/build_vector_stores.py --config params.yaml |
| 179 | +``` |
| 180 | + |
| 181 | +### Problem: Antivirus is blocking QueryPilot.exe |
| 182 | + |
| 183 | +**Solution:** |
| 184 | +- This is a false positive (common with packaged Python apps) |
| 185 | +- Add an exception for `QueryPilot.exe` in your antivirus settings |
| 186 | +- The exe is safe - it's just Python code packaged with PyInstaller |
| 187 | + |
| 188 | +### Problem: Suggestions are not appearing |
| 189 | + |
| 190 | +**Solution:** |
| 191 | +1. Make sure MySQL Workbench or pgAdmin 4 is the active window |
| 192 | +2. Check that you pressed Ctrl+C (not just C) |
| 193 | +3. Verify QueryPilot terminal shows "SQL Captured" |
| 194 | +4. Try again with a different SQL query |
| 195 | + |
| 196 | +### Problem: "Missing DLL" errors |
| 197 | + |
| 198 | +**Solution:** |
| 199 | +- Install Visual C++ Redistributable: https://aka.ms/vs/17/release/vc_redist.x64.exe |
| 200 | +- Restart your computer after installation |
| 201 | + |
| 202 | +## Performance Tips |
| 203 | + |
| 204 | +- **Faster suggestions**: Use FAISS vector store (default) |
| 205 | +- **Better suggestions**: Increase `vector_store.top_k` in `params.yaml` |
| 206 | +- **More context**: Increase `memory.limit` to remember more queries |
| 207 | + |
| 208 | +## Need More Help? |
| 209 | + |
| 210 | +- **Full Documentation**: See `README.md` in this folder |
| 211 | +- **Report Issues**: Contact the developer or check the project repository |
| 212 | + |
| 213 | +--- |
| 214 | + |
| 215 | +**Enjoy using QueryPilot! Happy querying! 🚀** |
0 commit comments