2424
2525---
2626
27- ## 3. UI/UX Specification
28-
29- ### Layout Structure
30-
31- ** Header**
32-
33- - Application title: "LLM SQL Analytics"
34- - Navigation: Dashboard, Query Interface, Schema Docs, Settings
35-
36- ** Main Content Area**
37-
38- - Dashboard: Overview of connected databases and recent queries
39- - Query Interface: Natural language input + SQL preview + results table
40- - Schema Docs: List of uploaded documents with semantic search
41- - Settings: Database connection configuration
42-
43- ** Footer**
44-
45- - Version info and copyright
46-
47- ### Visual Design
48-
49- ** Color Palette**
50-
51- - Primary: ` #1E3A5F ` (Deep Navy)
52- - Secondary: ` #3D5A80 ` (Slate Blue)
53- - Accent: ` #48CAE4 ` (Cyan)
54- - Background: ` #F8F9FA ` (Light Gray)
55- - Surface: ` #FFFFFF ` (White)
56- - Text Primary: ` #212529 ` (Dark Gray)
57- - Text Secondary: ` #6C757D ` (Medium Gray)
58- - Success: ` #28A745 ` (Green)
59- - Error: ` #DC3545 ` (Red)
60- - Warning: ` #FFC107 ` (Yellow)
61-
62- ** Typography**
63-
64- - Headings: "Inter", sans-serif, 600 weight
65- - Body: "Inter", sans-serif, 400 weight
66- - Monospace (SQL): "JetBrains Mono", monospace
67-
68- ** Spacing**
69-
70- - Base unit: 8px
71- - Container max-width: 1200px
72- - Card padding: 24px
73- - Section margin: 32px
74-
75- ### Components
76-
77- ** Query Input Card**
78-
79- - Textarea for natural language input
80- - "Generate SQL" button (primary style)
81- - "Execute" button (accent style)
82- - SQL preview panel with syntax highlighting
83-
84- ** Results Table**
85-
86- - Sortable columns
87- - Pagination for large results
88- - Export to CSV option
89-
90- ** Schema Doc Card**
91-
92- - Document name
93- - Upload date
94- - Preview snippet
95- - Semantic search input
96-
97- ** Database Connection Card**
98-
99- - Connection name
100- - Database type indicator
101- - Status indicator (connected/disconnected)
102- - Edit/Delete actions
103-
104- ---
105-
106- ## 4. Functionality Specification
27+ ## 3. Functionality Specification
10728
10829### Core Features
10930
110- #### 4 .1 Database Connection Management
31+ #### 3 .1 Database Connection Management
11132
11233- Add PostgreSQL database connections with connection details
11334- Test database connectivity
11435- Store connection configurations securely
11536- Support multiple database connections
11637
117- #### 4 .2 Schema Introspection
38+ #### 3 .2 Schema Introspection
11839
11940- Automatically fetch table names and column information
12041- Store schema in PostgreSQL with pgvector for semantic search
12142- Support uploading schema documentation (PDF)
12243
123- #### 4 .3 Natural Language to SQL
44+ #### 3 .3 Natural Language to SQL
12445
12546- Accept natural language queries
12647- Use LLM to convert natural language to SQL
12748- Support SELECT, INSERT, UPDATE, DELETE operations
12849- Include validation and error handling
12950
130- #### 4 .4 Semantic Schema Search
51+ #### 3 .4 Semantic Schema Search
13152
13253- Embed schema documentation using sentence-transformers
13354- Store embeddings in pgvector
13455- Search schema semantically to find relevant tables/columns
13556
136- #### 4 .5 Query Execution
57+ #### 3 .5 Query Execution
13758
13859- Execute generated SQL against target database
13960- Return formatted results
14061- Handle errors gracefully with user-friendly messages
14162
142- #### 4 .6 Query History
63+ #### 3 .6 Query History
14364
14465- Store all queries with timestamps
14566- View past queries and their results
16889
16990---
17091
171- ## 5. Database Schema
172-
173- ### Django Models
174-
175- ```
176- DatabaseConnection
177- - id: UUID (primary key)
178- - name: CharField (unique)
179- - host: CharField
180- - port: IntegerField
181- - database: CharField
182- - username: CharField
183- - password: CharField (encrypted)
184- - created_at: DateTimeField
185- - updated_at: DateTimeField
186- - is_active: BooleanField
187-
188- SchemaDocument
189- - id: UUID (primary key)
190- - connection: ForeignKey(DatabaseConnection)
191- - name: CharField
192- - content: TextField
193- - embedding: VectorField (pgvector)
194- - uploaded_at: DateTimeField
195-
196- QueryHistory
197- - id: UUID (primary key)
198- - connection: ForeignKey(DatabaseConnection)
199- - natural_language: TextField
200- - generated_sql: TextField
201- - executed_sql: TextField (nullable)
202- - result: JSONField (nullable)
203- - error: TextField (nullable)
204- - created_at: DateTimeField
205- ```
206-
207- ---
208-
209- ## 6. API Endpoints
92+ ## 4. API Endpoints
21093
21194| Method | Endpoint | Description |
21295| ------ | ----------------------------- | ------------------------------ |
@@ -225,7 +108,7 @@ QueryHistory
225108
226109---
227110
228- ## 7 . Acceptance Criteria
111+ ## 5 . Acceptance Criteria
229112
2301131 . ✓ User can add PostgreSQL database connections
2311142 . ✓ User can test database connectivity
0 commit comments