sqlshell 0.2.3__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sqlshell might be problematic. Click here for more details.
- {sqlshell-0.2.3 → sqlshell-0.3.0}/.gitignore +14 -5
- {sqlshell-0.2.3/sqlshell.egg-info → sqlshell-0.3.0}/PKG-INFO +126 -7
- {sqlshell-0.2.3 → sqlshell-0.3.0}/README.md +123 -5
- sqlshell-0.3.0/assets/images/column_encoding.png +0 -0
- sqlshell-0.3.0/docs/F5_F9_FUNCTIONALITY.md +265 -0
- sqlshell-0.3.0/docs/IMPLEMENTATION_SUMMARY.md +201 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/main.py +385 -2
- {sqlshell-0.2.3 → sqlshell-0.3.0}/pyproject.toml +4 -3
- {sqlshell-0.2.3 → sqlshell-0.3.0}/requirements.txt +2 -1
- sqlshell-0.3.0/sqlshell/__init__.py +44 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/db/__init__.py +2 -1
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/db/database_manager.py +336 -23
- sqlshell-0.3.0/sqlshell/db/export_manager.py +188 -0
- sqlshell-0.3.0/sqlshell/editor_integration.py +127 -0
- sqlshell-0.3.0/sqlshell/execution_handler.py +421 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/main.py +570 -140
- sqlshell-0.3.0/sqlshell/query_tab.py +786 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/ui/filter_header.py +22 -1
- sqlshell-0.3.0/sqlshell/utils/profile_column.py +2515 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/utils/profile_foreign_keys.py +103 -11
- sqlshell-0.3.0/sqlshell/utils/profile_ohe.py +631 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0/sqlshell.egg-info}/PKG-INFO +126 -7
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell.egg-info/SOURCES.txt +12 -4
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell.egg-info/requires.txt +2 -1
- sqlshell-0.3.0/tests/test_query_executor.py +92 -0
- sqlshell-0.2.3/sqlshell/__init__.py +0 -14
- sqlshell-0.2.3/sqlshell/query_tab.py +0 -201
- sqlshell-0.2.3/sqlshell/utils/profile_column.py +0 -1099
- {sqlshell-0.2.3 → sqlshell-0.3.0}/MANIFEST.in +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0/assets/images}/column_profiler.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0/assets/images}/sqlshell_demo.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0/assets/images}/sqlshell_logo.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/run.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/setup.cfg +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/LICENSE +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/MANIFEST.in +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/README.md +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/context_suggester.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/create_test_data.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/data/create_test_data.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/editor.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/menus.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/__init__.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/create_icon.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/create_splash.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/icon.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/logo_large.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/logo_medium.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/logo_small.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/resources/splash_screen.gif +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/splash_screen.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/sqlshell/__init__.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/sqlshell/create_test_data.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/sqlshell/create_test_databases.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/sqlshell_demo.png +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/styles.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/suggester_integration.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/syntax_highlighter.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/table_list.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/ui/__init__.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/ui/bar_chart_delegate.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/utils/__init__.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/utils/profile_distributions.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/utils/profile_entropy.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell/utils/profile_keys.py +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell.egg-info/dependency_links.txt +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell.egg-info/entry_points.txt +0 -0
- {sqlshell-0.2.3 → sqlshell-0.3.0}/sqlshell.egg-info/top_level.txt +0 -0
|
@@ -30,6 +30,9 @@ tests/data/*.delta
|
|
|
30
30
|
tests/data/*.duckdb
|
|
31
31
|
tests/data/*.sqls
|
|
32
32
|
|
|
33
|
+
# Sample data files - exclude CSV files but keep other sample files
|
|
34
|
+
sample_data/*.csv
|
|
35
|
+
|
|
33
36
|
# IDE
|
|
34
37
|
.idea/
|
|
35
38
|
.vscode/
|
|
@@ -61,11 +64,8 @@ ENV/
|
|
|
61
64
|
.venv
|
|
62
65
|
|
|
63
66
|
# Project specific
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
*.xls
|
|
67
|
-
*.csv
|
|
68
|
-
sample_sales_data.xlsx
|
|
67
|
+
# Don't ignore sample_data/ since it contains example files
|
|
68
|
+
# But ignore any dynamic database files
|
|
69
69
|
pool.db
|
|
70
70
|
|
|
71
71
|
# Logs
|
|
@@ -86,3 +86,12 @@ tests/
|
|
|
86
86
|
*.sqls
|
|
87
87
|
sqlshell-0.2.0/
|
|
88
88
|
TODO
|
|
89
|
+
|
|
90
|
+
# Temporary files and directories
|
|
91
|
+
temp/
|
|
92
|
+
tmp/
|
|
93
|
+
*.tmp
|
|
94
|
+
|
|
95
|
+
# Backup files
|
|
96
|
+
*.bak
|
|
97
|
+
*.backup
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sqlshell
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A powerful SQL shell with GUI interface for data analysis
|
|
5
5
|
Author: SQLShell Team
|
|
6
6
|
License-Expression: MIT
|
|
@@ -25,21 +25,22 @@ Requires-Dist: fastparquet>=2023.10.1
|
|
|
25
25
|
Requires-Dist: xlrd>=2.0.1
|
|
26
26
|
Requires-Dist: deltalake
|
|
27
27
|
Requires-Dist: Pillow>=10.0.0
|
|
28
|
-
Requires-Dist: shap
|
|
29
28
|
Requires-Dist: xgboost
|
|
30
29
|
Requires-Dist: scikit-learn
|
|
31
30
|
Requires-Dist: matplotlib>=3.10.0
|
|
32
31
|
Requires-Dist: scipy>=1.15.0
|
|
32
|
+
Requires-Dist: seaborn>=0.13.0
|
|
33
|
+
Requires-Dist: nltk>=3.8.1
|
|
33
34
|
|
|
34
35
|
# SQLShell
|
|
35
36
|
|
|
36
37
|
<div align="center">
|
|
37
38
|
|
|
38
|
-
<img src="https://
|
|
39
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/sqlshell_logo.png" alt="SQLShell Logo" width="180" height="auto">
|
|
39
40
|
|
|
40
41
|
**A powerful SQL shell with GUI interface for data analysis**
|
|
41
42
|
|
|
42
|
-
<img src="https://
|
|
43
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/sqlshell_demo.png" alt="SQLShell Interface" width="80%" height="auto">
|
|
43
44
|
|
|
44
45
|
</div>
|
|
45
46
|
|
|
@@ -53,9 +54,18 @@ Requires-Dist: scipy>=1.15.0
|
|
|
53
54
|
- **Table Preview** - Quick view of imported data tables
|
|
54
55
|
- **Test Data Generation** - Built-in sample data for testing and learning
|
|
55
56
|
- **Multiple Views** - Support for multiple concurrent table views
|
|
56
|
-
- **Productivity Tools** - Streamlined workflow with
|
|
57
|
+
- **Productivity Tools** - Streamlined workflow with F5/F9 shortcuts and Ctrl+Enter for query execution
|
|
57
58
|
- **Explain Column** - Analyze relationships between data columns directly from query results
|
|
58
59
|
|
|
60
|
+
## ⚡ F5/F9 Quick Execution
|
|
61
|
+
|
|
62
|
+
SQLShell includes powerful keyboard shortcuts for efficient SQL execution:
|
|
63
|
+
|
|
64
|
+
- **F5**: Execute all SQL statements in the editor sequentially
|
|
65
|
+
- **F9**: Execute only the current SQL statement (where your cursor is positioned)
|
|
66
|
+
|
|
67
|
+
This allows for rapid testing and development - place your cursor in any statement and press F9 to execute just that query, or press F5 to run everything.
|
|
68
|
+
|
|
59
69
|
## 📦 Installation
|
|
60
70
|
|
|
61
71
|
### Using pip (Recommended)
|
|
@@ -166,7 +176,7 @@ FROM test_v;
|
|
|
166
176
|
SQLShell provides powerful table profiling tools to help you understand your data. These tools are accessible from the left-hand side table menu via right-click on any table:
|
|
167
177
|
|
|
168
178
|
<div align="center">
|
|
169
|
-
<img src="https://
|
|
179
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
170
180
|
</div>
|
|
171
181
|
|
|
172
182
|
### Table Profiling Options
|
|
@@ -261,7 +271,50 @@ The Column Profiler now offers in-depth multivariate analysis to explore relatio
|
|
|
261
271
|
- Identify patterns and outliers in multivariate relationships
|
|
262
272
|
- Make better decisions about feature selection for analysis and modeling
|
|
263
273
|
|
|
264
|
-
This feature is particularly useful for
|
|
274
|
+
This feature is particularly useful for data scientists and analysts who need to understand variable relationships quickly without writing complex correlation queries.
|
|
275
|
+
|
|
276
|
+
### One-hot encoding
|
|
277
|
+
|
|
278
|
+
If you are working with text (i.e. job description or job title to analyze salary), you would want to
|
|
279
|
+
do 'one-hot encoding'.
|
|
280
|
+
|
|
281
|
+
1. **How to Access**:
|
|
282
|
+
- Right-click on any column header in the query results table
|
|
283
|
+
- Select "Encode text" from the context menu
|
|
284
|
+
|
|
285
|
+
<div align="center">
|
|
286
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/column_encoding.png" alt="Column Profiler" width="80%" height="auto">
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
2. **How It Works**:
|
|
290
|
+
- SQLShell tokenizes the text into meaningful words and phrases
|
|
291
|
+
- Each unique token becomes a new binary feature (1 if present, 0 if absent)
|
|
292
|
+
- The system applies intelligent filtering to remove common words with low information value
|
|
293
|
+
- Results appear as a new query with encoded columns automatically added
|
|
294
|
+
|
|
295
|
+
<!-- Screenshot 2: Encoding process/dialog showing options -->
|
|
296
|
+
|
|
297
|
+
3. **Applications**:
|
|
298
|
+
- Analyze how specific keywords in job descriptions correlate with salary levels
|
|
299
|
+
- Identify which terms in product descriptions drive higher sales
|
|
300
|
+
- Extract features from unstructured text for further analysis
|
|
301
|
+
- Prepare text data for statistical modeling and machine learning
|
|
302
|
+
|
|
303
|
+
4. **Using the Encoded Data**:
|
|
304
|
+
- After encoding, SQLShell presents a visualization showing top correlations
|
|
305
|
+
- Sort encoded features by correlation strength to identify key terms
|
|
306
|
+
- Use encoded columns in subsequent queries for deeper analysis
|
|
307
|
+
- Join encoded results with other tables for cross-dataset insights
|
|
308
|
+
|
|
309
|
+
<!-- Screenshot 3: Results showing correlation between job descriptions and salary -->
|
|
310
|
+
|
|
311
|
+
5. **Benefits**:
|
|
312
|
+
- Transform unstructured text into structured, analyzable data
|
|
313
|
+
- Discover hidden patterns between text content and numerical outcomes
|
|
314
|
+
- Identify specific terms that have the strongest relationship with target variables
|
|
315
|
+
- Perform advanced text analysis without specialized NLP knowledge
|
|
316
|
+
|
|
317
|
+
This feature is particularly powerful for HR analytics, marketing text analysis, and any scenario where you need to extract insights from unstructured text data.
|
|
265
318
|
|
|
266
319
|
## 📋 Requirements
|
|
267
320
|
|
|
@@ -279,3 +332,69 @@ This feature is particularly useful for exploratory data analysis, helping you u
|
|
|
279
332
|
## 📄 License
|
|
280
333
|
|
|
281
334
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
335
|
+
|
|
336
|
+
## 📁 Project Structure
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
SQLShell/
|
|
340
|
+
├── sqlshell/ # Main package
|
|
341
|
+
│ ├── __init__.py
|
|
342
|
+
│ ├── main.py # Main application entry point
|
|
343
|
+
│ ├── execution_handler.py # F5/F9 SQL execution functionality
|
|
344
|
+
│ ├── editor_integration.py # Editor integration utilities
|
|
345
|
+
│ ├── query_tab.py # Query tab implementation
|
|
346
|
+
│ ├── splash_screen.py # Application splash screen
|
|
347
|
+
│ └── styles.py # UI styling
|
|
348
|
+
├── tests/ # Test files
|
|
349
|
+
│ ├── f5_f9_functionality/ # F5/F9 functionality tests and demos
|
|
350
|
+
│ │ ├── README.md # Documentation for F5/F9 tests
|
|
351
|
+
│ │ ├── test_execution_handler.py # Comprehensive test suite
|
|
352
|
+
│ │ └── demo_f5_f9.py # Interactive demo
|
|
353
|
+
│ └── test_query_executor.py # Other test files
|
|
354
|
+
├── docs/ # Documentation
|
|
355
|
+
│ ├── F5_F9_FUNCTIONALITY.md # Detailed F5/F9 documentation
|
|
356
|
+
│ └── IMPLEMENTATION_SUMMARY.md # Implementation details
|
|
357
|
+
├── assets/ # Assets and resources
|
|
358
|
+
│ └── images/ # Images and screenshots
|
|
359
|
+
│ ├── sqlshell_logo.png
|
|
360
|
+
│ ├── sqlshell_demo.png
|
|
361
|
+
│ ├── column_profiler.png
|
|
362
|
+
│ └── column_encoding.png
|
|
363
|
+
├── sample_data/ # Sample data files
|
|
364
|
+
│ ├── test_*.csv # Test CSV files
|
|
365
|
+
│ ├── california_housing_data.parquet
|
|
366
|
+
│ └── pool.db # Sample database
|
|
367
|
+
├── main.py # Application launcher
|
|
368
|
+
├── run.py # Alternative launcher
|
|
369
|
+
├── README.md # This file
|
|
370
|
+
├── requirements.txt # Python dependencies
|
|
371
|
+
├── pyproject.toml # Project configuration
|
|
372
|
+
└── MANIFEST.in # Package manifest
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## 🧪 Testing
|
|
376
|
+
|
|
377
|
+
The project includes comprehensive tests for the F5/F9 functionality:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Run the interactive test suite
|
|
381
|
+
cd tests/f5_f9_functionality
|
|
382
|
+
python test_execution_handler.py
|
|
383
|
+
|
|
384
|
+
# Try the interactive demo
|
|
385
|
+
python demo_f5_f9.py
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
For complete documentation on F5/F9 functionality, see `docs/F5_F9_FUNCTIONALITY.md`.
|
|
389
|
+
|
|
390
|
+
## 🤝 Contributing
|
|
391
|
+
|
|
392
|
+
1. Fork the repository
|
|
393
|
+
2. Create a feature branch
|
|
394
|
+
3. Make your changes
|
|
395
|
+
4. Add tests if applicable
|
|
396
|
+
5. Submit a pull request
|
|
397
|
+
|
|
398
|
+
## 📄 License
|
|
399
|
+
|
|
400
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-
<img src="https://
|
|
5
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/sqlshell_logo.png" alt="SQLShell Logo" width="180" height="auto">
|
|
6
6
|
|
|
7
7
|
**A powerful SQL shell with GUI interface for data analysis**
|
|
8
8
|
|
|
9
|
-
<img src="https://
|
|
9
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/sqlshell_demo.png" alt="SQLShell Interface" width="80%" height="auto">
|
|
10
10
|
|
|
11
11
|
</div>
|
|
12
12
|
|
|
@@ -20,9 +20,18 @@
|
|
|
20
20
|
- **Table Preview** - Quick view of imported data tables
|
|
21
21
|
- **Test Data Generation** - Built-in sample data for testing and learning
|
|
22
22
|
- **Multiple Views** - Support for multiple concurrent table views
|
|
23
|
-
- **Productivity Tools** - Streamlined workflow with
|
|
23
|
+
- **Productivity Tools** - Streamlined workflow with F5/F9 shortcuts and Ctrl+Enter for query execution
|
|
24
24
|
- **Explain Column** - Analyze relationships between data columns directly from query results
|
|
25
25
|
|
|
26
|
+
## ⚡ F5/F9 Quick Execution
|
|
27
|
+
|
|
28
|
+
SQLShell includes powerful keyboard shortcuts for efficient SQL execution:
|
|
29
|
+
|
|
30
|
+
- **F5**: Execute all SQL statements in the editor sequentially
|
|
31
|
+
- **F9**: Execute only the current SQL statement (where your cursor is positioned)
|
|
32
|
+
|
|
33
|
+
This allows for rapid testing and development - place your cursor in any statement and press F9 to execute just that query, or press F5 to run everything.
|
|
34
|
+
|
|
26
35
|
## 📦 Installation
|
|
27
36
|
|
|
28
37
|
### Using pip (Recommended)
|
|
@@ -133,7 +142,7 @@ FROM test_v;
|
|
|
133
142
|
SQLShell provides powerful table profiling tools to help you understand your data. These tools are accessible from the left-hand side table menu via right-click on any table:
|
|
134
143
|
|
|
135
144
|
<div align="center">
|
|
136
|
-
<img src="https://
|
|
145
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
137
146
|
</div>
|
|
138
147
|
|
|
139
148
|
### Table Profiling Options
|
|
@@ -228,7 +237,50 @@ The Column Profiler now offers in-depth multivariate analysis to explore relatio
|
|
|
228
237
|
- Identify patterns and outliers in multivariate relationships
|
|
229
238
|
- Make better decisions about feature selection for analysis and modeling
|
|
230
239
|
|
|
231
|
-
This feature is particularly useful for
|
|
240
|
+
This feature is particularly useful for data scientists and analysts who need to understand variable relationships quickly without writing complex correlation queries.
|
|
241
|
+
|
|
242
|
+
### One-hot encoding
|
|
243
|
+
|
|
244
|
+
If you are working with text (i.e. job description or job title to analyze salary), you would want to
|
|
245
|
+
do 'one-hot encoding'.
|
|
246
|
+
|
|
247
|
+
1. **How to Access**:
|
|
248
|
+
- Right-click on any column header in the query results table
|
|
249
|
+
- Select "Encode text" from the context menu
|
|
250
|
+
|
|
251
|
+
<div align="center">
|
|
252
|
+
<img src="https://raw.githubusercontent.com/oyvinrog/SQLShell/main/assets/images/column_encoding.png" alt="Column Profiler" width="80%" height="auto">
|
|
253
|
+
</div>
|
|
254
|
+
|
|
255
|
+
2. **How It Works**:
|
|
256
|
+
- SQLShell tokenizes the text into meaningful words and phrases
|
|
257
|
+
- Each unique token becomes a new binary feature (1 if present, 0 if absent)
|
|
258
|
+
- The system applies intelligent filtering to remove common words with low information value
|
|
259
|
+
- Results appear as a new query with encoded columns automatically added
|
|
260
|
+
|
|
261
|
+
<!-- Screenshot 2: Encoding process/dialog showing options -->
|
|
262
|
+
|
|
263
|
+
3. **Applications**:
|
|
264
|
+
- Analyze how specific keywords in job descriptions correlate with salary levels
|
|
265
|
+
- Identify which terms in product descriptions drive higher sales
|
|
266
|
+
- Extract features from unstructured text for further analysis
|
|
267
|
+
- Prepare text data for statistical modeling and machine learning
|
|
268
|
+
|
|
269
|
+
4. **Using the Encoded Data**:
|
|
270
|
+
- After encoding, SQLShell presents a visualization showing top correlations
|
|
271
|
+
- Sort encoded features by correlation strength to identify key terms
|
|
272
|
+
- Use encoded columns in subsequent queries for deeper analysis
|
|
273
|
+
- Join encoded results with other tables for cross-dataset insights
|
|
274
|
+
|
|
275
|
+
<!-- Screenshot 3: Results showing correlation between job descriptions and salary -->
|
|
276
|
+
|
|
277
|
+
5. **Benefits**:
|
|
278
|
+
- Transform unstructured text into structured, analyzable data
|
|
279
|
+
- Discover hidden patterns between text content and numerical outcomes
|
|
280
|
+
- Identify specific terms that have the strongest relationship with target variables
|
|
281
|
+
- Perform advanced text analysis without specialized NLP knowledge
|
|
282
|
+
|
|
283
|
+
This feature is particularly powerful for HR analytics, marketing text analysis, and any scenario where you need to extract insights from unstructured text data.
|
|
232
284
|
|
|
233
285
|
## 📋 Requirements
|
|
234
286
|
|
|
@@ -246,3 +298,69 @@ This feature is particularly useful for exploratory data analysis, helping you u
|
|
|
246
298
|
## 📄 License
|
|
247
299
|
|
|
248
300
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
301
|
+
|
|
302
|
+
## 📁 Project Structure
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
SQLShell/
|
|
306
|
+
├── sqlshell/ # Main package
|
|
307
|
+
│ ├── __init__.py
|
|
308
|
+
│ ├── main.py # Main application entry point
|
|
309
|
+
│ ├── execution_handler.py # F5/F9 SQL execution functionality
|
|
310
|
+
│ ├── editor_integration.py # Editor integration utilities
|
|
311
|
+
│ ├── query_tab.py # Query tab implementation
|
|
312
|
+
│ ├── splash_screen.py # Application splash screen
|
|
313
|
+
│ └── styles.py # UI styling
|
|
314
|
+
├── tests/ # Test files
|
|
315
|
+
│ ├── f5_f9_functionality/ # F5/F9 functionality tests and demos
|
|
316
|
+
│ │ ├── README.md # Documentation for F5/F9 tests
|
|
317
|
+
│ │ ├── test_execution_handler.py # Comprehensive test suite
|
|
318
|
+
│ │ └── demo_f5_f9.py # Interactive demo
|
|
319
|
+
│ └── test_query_executor.py # Other test files
|
|
320
|
+
├── docs/ # Documentation
|
|
321
|
+
│ ├── F5_F9_FUNCTIONALITY.md # Detailed F5/F9 documentation
|
|
322
|
+
│ └── IMPLEMENTATION_SUMMARY.md # Implementation details
|
|
323
|
+
├── assets/ # Assets and resources
|
|
324
|
+
│ └── images/ # Images and screenshots
|
|
325
|
+
│ ├── sqlshell_logo.png
|
|
326
|
+
│ ├── sqlshell_demo.png
|
|
327
|
+
│ ├── column_profiler.png
|
|
328
|
+
│ └── column_encoding.png
|
|
329
|
+
├── sample_data/ # Sample data files
|
|
330
|
+
│ ├── test_*.csv # Test CSV files
|
|
331
|
+
│ ├── california_housing_data.parquet
|
|
332
|
+
│ └── pool.db # Sample database
|
|
333
|
+
├── main.py # Application launcher
|
|
334
|
+
├── run.py # Alternative launcher
|
|
335
|
+
├── README.md # This file
|
|
336
|
+
├── requirements.txt # Python dependencies
|
|
337
|
+
├── pyproject.toml # Project configuration
|
|
338
|
+
└── MANIFEST.in # Package manifest
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## 🧪 Testing
|
|
342
|
+
|
|
343
|
+
The project includes comprehensive tests for the F5/F9 functionality:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Run the interactive test suite
|
|
347
|
+
cd tests/f5_f9_functionality
|
|
348
|
+
python test_execution_handler.py
|
|
349
|
+
|
|
350
|
+
# Try the interactive demo
|
|
351
|
+
python demo_f5_f9.py
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
For complete documentation on F5/F9 functionality, see `docs/F5_F9_FUNCTIONALITY.md`.
|
|
355
|
+
|
|
356
|
+
## 🤝 Contributing
|
|
357
|
+
|
|
358
|
+
1. Fork the repository
|
|
359
|
+
2. Create a feature branch
|
|
360
|
+
3. Make your changes
|
|
361
|
+
4. Add tests if applicable
|
|
362
|
+
5. Submit a pull request
|
|
363
|
+
|
|
364
|
+
## 📄 License
|
|
365
|
+
|
|
366
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
Binary file
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# F5/F9 SQL Execution Functionality
|
|
2
|
+
|
|
3
|
+
This document describes the new modular F5/F9 execution functionality added to SQLShell, which allows you to execute SQL statements individually or all at once.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The F5/F9 functionality provides a convenient way to execute SQL statements in your editor:
|
|
8
|
+
|
|
9
|
+
- **F5**: Execute all SQL statements in the editor
|
|
10
|
+
- **F9**: Execute the current SQL statement (the statement containing the cursor)
|
|
11
|
+
- **Ctrl+Enter**: Execute the entire editor content (existing behavior)
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
### 🚀 Key Features
|
|
16
|
+
|
|
17
|
+
1. **Smart Statement Parsing**: Automatically detects individual SQL statements separated by semicolons
|
|
18
|
+
2. **Comment Handling**: Properly handles SQL comments (`--` and `/* */`) and string literals
|
|
19
|
+
3. **String Literal Support**: Correctly handles semicolons inside string literals
|
|
20
|
+
4. **Cursor-Based Execution**: F9 executes only the statement where your cursor is positioned
|
|
21
|
+
5. **Visual Feedback**: Clear status messages showing which statement was executed
|
|
22
|
+
6. **Non-Destructive**: Doesn't modify your original query text
|
|
23
|
+
|
|
24
|
+
### 🎯 Use Cases
|
|
25
|
+
|
|
26
|
+
- **Development**: Test individual queries while developing complex multi-statement scripts
|
|
27
|
+
- **Debugging**: Execute specific statements to isolate issues
|
|
28
|
+
- **Data Exploration**: Run different analytical queries sequentially
|
|
29
|
+
- **Migration Scripts**: Execute database migration statements one by one
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
### Basic Usage
|
|
34
|
+
|
|
35
|
+
1. **Write Multiple SQL Statements**: Separate each statement with a semicolon (`;`)
|
|
36
|
+
```sql
|
|
37
|
+
SELECT * FROM employees WHERE department = 'Engineering';
|
|
38
|
+
|
|
39
|
+
SELECT * FROM projects WHERE status = 'Active';
|
|
40
|
+
|
|
41
|
+
SELECT COUNT(*) FROM assignments;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. **Execute All Statements (F5)**:
|
|
45
|
+
- Press `F5` or click the "F5 - Execute All" button
|
|
46
|
+
- All statements will be executed sequentially
|
|
47
|
+
- Results from the last statement will be displayed
|
|
48
|
+
|
|
49
|
+
3. **Execute Current Statement (F9)**:
|
|
50
|
+
- Place your cursor anywhere within a SQL statement
|
|
51
|
+
- Press `F9` or click the "F9 - Execute Current" button
|
|
52
|
+
- Only that statement will be executed
|
|
53
|
+
|
|
54
|
+
### Advanced Examples
|
|
55
|
+
|
|
56
|
+
#### Example 1: Data Analysis Workflow
|
|
57
|
+
```sql
|
|
58
|
+
-- Step 1: Get basic employee stats
|
|
59
|
+
SELECT department, COUNT(*) as emp_count, AVG(salary) as avg_salary
|
|
60
|
+
FROM employees
|
|
61
|
+
GROUP BY department;
|
|
62
|
+
|
|
63
|
+
-- Step 2: Find high performers
|
|
64
|
+
SELECT name, department, salary
|
|
65
|
+
FROM employees
|
|
66
|
+
WHERE salary > (SELECT AVG(salary) FROM employees)
|
|
67
|
+
ORDER BY salary DESC;
|
|
68
|
+
|
|
69
|
+
-- Step 3: Project workload analysis
|
|
70
|
+
SELECT p.project_name, COUNT(a.employee_id) as team_size
|
|
71
|
+
FROM projects p
|
|
72
|
+
LEFT JOIN assignments a ON p.project_id = a.project_id
|
|
73
|
+
GROUP BY p.project_name
|
|
74
|
+
ORDER BY team_size DESC;
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Example 2: Database Setup Script
|
|
78
|
+
```sql
|
|
79
|
+
-- Create temporary table
|
|
80
|
+
CREATE TEMPORARY TABLE temp_analysis AS
|
|
81
|
+
SELECT department, AVG(salary) as avg_salary
|
|
82
|
+
FROM employees
|
|
83
|
+
GROUP BY department;
|
|
84
|
+
|
|
85
|
+
-- Analyze the data
|
|
86
|
+
SELECT * FROM temp_analysis WHERE avg_salary > 65000;
|
|
87
|
+
|
|
88
|
+
-- Clean up
|
|
89
|
+
DROP TABLE IF EXISTS temp_analysis;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Technical Implementation
|
|
93
|
+
|
|
94
|
+
### Architecture
|
|
95
|
+
|
|
96
|
+
The F5/F9 functionality is implemented using a modular architecture:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
sqlshell/
|
|
100
|
+
├── execution_handler.py # Core parsing and execution logic
|
|
101
|
+
├── editor_integration.py # Integration with SQLEditor
|
|
102
|
+
└── query_tab.py # UI integration
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Key Components
|
|
106
|
+
|
|
107
|
+
1. **SQLExecutionHandler**: Parses SQL text and handles execution
|
|
108
|
+
2. **ExecutionKeyHandler**: Manages F5/F9 key press events
|
|
109
|
+
3. **EditorExecutionIntegration**: Integrates with existing SQLEditor
|
|
110
|
+
|
|
111
|
+
### Statement Parsing Features
|
|
112
|
+
|
|
113
|
+
- **Comment Removal**: Safely removes `--` and `/* */` comments while preserving string literals
|
|
114
|
+
- **String Handling**: Properly handles single and double quotes, including escaped quotes
|
|
115
|
+
- **Semicolon Detection**: Smart detection of statement-ending semicolons
|
|
116
|
+
- **Position Tracking**: Tracks start and end positions of each statement
|
|
117
|
+
|
|
118
|
+
## Testing
|
|
119
|
+
|
|
120
|
+
### Test Files
|
|
121
|
+
|
|
122
|
+
- **`test_execution_handler.py`**: Comprehensive testing UI for F5/F9 functionality
|
|
123
|
+
- **`demo_f5_f9.py`**: Demo script with sample data
|
|
124
|
+
|
|
125
|
+
### Running Tests
|
|
126
|
+
|
|
127
|
+
1. **Basic Tests** (command line):
|
|
128
|
+
```bash
|
|
129
|
+
python test_execution_handler.py --test
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
2. **Interactive Test UI**:
|
|
133
|
+
```bash
|
|
134
|
+
python test_execution_handler.py
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
3. **Full Demo with Sample Data**:
|
|
138
|
+
```bash
|
|
139
|
+
python demo_f5_f9.py
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Integration Guide
|
|
143
|
+
|
|
144
|
+
### For Developers
|
|
145
|
+
|
|
146
|
+
To integrate F5/F9 functionality into an existing SQLEditor:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from sqlshell.editor_integration import integrate_execution_functionality
|
|
150
|
+
|
|
151
|
+
# Integrate with your editor
|
|
152
|
+
integration = integrate_execution_functionality(
|
|
153
|
+
your_editor,
|
|
154
|
+
execute_callback=your_execute_function
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
# The editor now supports F5/F9 automatically
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Custom Execution Callback
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
def my_execute_callback(query_text):
|
|
164
|
+
"""Custom function to execute a SQL query."""
|
|
165
|
+
# Your database execution logic here
|
|
166
|
+
result = database.execute(query_text)
|
|
167
|
+
# Handle result display
|
|
168
|
+
display_results(result)
|
|
169
|
+
|
|
170
|
+
# Set the callback
|
|
171
|
+
integration.set_execute_callback(my_execute_callback)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## User Interface
|
|
175
|
+
|
|
176
|
+
### New UI Elements
|
|
177
|
+
|
|
178
|
+
1. **F5 - Execute All Button**: Executes all statements sequentially
|
|
179
|
+
2. **F9 - Execute Current Button**: Executes the statement at cursor position
|
|
180
|
+
3. **Enhanced Help Text**: Updated instructions showing F5/F9 usage
|
|
181
|
+
|
|
182
|
+
### Status Bar Messages
|
|
183
|
+
|
|
184
|
+
- `Statement executed: [query preview] | Time: 0.15s | Rows: 42`
|
|
185
|
+
- `Executed 4 statement(s)` (for F5)
|
|
186
|
+
- Clear indication of which functionality was used
|
|
187
|
+
|
|
188
|
+
## Keyboard Shortcuts
|
|
189
|
+
|
|
190
|
+
| Shortcut | Action | Description |
|
|
191
|
+
|----------|--------|-------------|
|
|
192
|
+
| `F5` | Execute All | Run all SQL statements in the editor |
|
|
193
|
+
| `F9` | Execute Current | Run the statement containing the cursor |
|
|
194
|
+
| `Ctrl+Enter` | Execute Query | Run entire editor content (existing) |
|
|
195
|
+
|
|
196
|
+
## Error Handling
|
|
197
|
+
|
|
198
|
+
### Robust Error Management
|
|
199
|
+
|
|
200
|
+
- **Empty Statements**: Gracefully skips empty statements
|
|
201
|
+
- **Syntax Errors**: Shows clear error messages with statement context
|
|
202
|
+
- **Connection Issues**: Handles database connection problems
|
|
203
|
+
- **Parsing Errors**: Provides fallback behavior for complex SQL
|
|
204
|
+
|
|
205
|
+
### Error Messages
|
|
206
|
+
|
|
207
|
+
- Clear indication of which statement failed
|
|
208
|
+
- Preservation of original query text
|
|
209
|
+
- Non-blocking error handling (other statements can still execute)
|
|
210
|
+
|
|
211
|
+
## Best Practices
|
|
212
|
+
|
|
213
|
+
### Writing Multi-Statement SQL
|
|
214
|
+
|
|
215
|
+
1. **Use Clear Separation**: Always end statements with semicolons
|
|
216
|
+
2. **Add Comments**: Document what each statement does
|
|
217
|
+
3. **Test Incrementally**: Use F9 to test each statement individually
|
|
218
|
+
4. **Handle Dependencies**: Be aware of statement execution order for F5
|
|
219
|
+
|
|
220
|
+
### Example Best Practice
|
|
221
|
+
```sql
|
|
222
|
+
-- Step 1: Data preparation
|
|
223
|
+
CREATE TEMPORARY TABLE employee_stats AS
|
|
224
|
+
SELECT department, COUNT(*) as count, AVG(salary) as avg_sal
|
|
225
|
+
FROM employees
|
|
226
|
+
GROUP BY department;
|
|
227
|
+
|
|
228
|
+
-- Step 2: Analysis (depends on Step 1)
|
|
229
|
+
SELECT * FROM employee_stats
|
|
230
|
+
WHERE avg_sal > 70000
|
|
231
|
+
ORDER BY count DESC;
|
|
232
|
+
|
|
233
|
+
-- Step 3: Cleanup (always include cleanup)
|
|
234
|
+
DROP TABLE IF EXISTS employee_stats;
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Troubleshooting
|
|
238
|
+
|
|
239
|
+
### Common Issues
|
|
240
|
+
|
|
241
|
+
1. **F5/F9 Not Working**: Ensure the editor has focus and the integration is properly loaded
|
|
242
|
+
2. **Wrong Statement Executed**: Check cursor position; F9 executes the statement containing the cursor
|
|
243
|
+
3. **Parsing Issues**: Complex string literals with semicolons may need careful quoting
|
|
244
|
+
|
|
245
|
+
### Debug Information
|
|
246
|
+
|
|
247
|
+
Enable debug mode by running:
|
|
248
|
+
```bash
|
|
249
|
+
python test_execution_handler.py
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
This provides detailed parsing information and execution logs.
|
|
253
|
+
|
|
254
|
+
## Future Enhancements
|
|
255
|
+
|
|
256
|
+
### Planned Features
|
|
257
|
+
|
|
258
|
+
- **Statement Highlighting**: Visual indication of which statement will be executed
|
|
259
|
+
- **Execution History**: Track and replay previously executed statements
|
|
260
|
+
- **Batch Execution Options**: More granular control over statement execution
|
|
261
|
+
- **Performance Metrics**: Detailed timing and resource usage for each statement
|
|
262
|
+
|
|
263
|
+
### Feedback and Contributions
|
|
264
|
+
|
|
265
|
+
The F5/F9 functionality is designed to be modular and extensible. Contributions and feedback are welcome!
|