sqlshell 0.1.9__tar.gz → 0.2.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.0/.gitignore +87 -0
- sqlshell-0.2.0/MANIFEST.in +20 -0
- sqlshell-0.2.0/PKG-INFO +198 -0
- sqlshell-0.2.0/README.md +170 -0
- sqlshell-0.2.0/column_profiler.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/pyproject.toml +35 -5
- sqlshell-0.2.0/requirements.txt +10 -0
- sqlshell-0.2.0/run.py +29 -0
- sqlshell-0.2.0/sqlshell/LICENSE +21 -0
- sqlshell-0.2.0/sqlshell/MANIFEST.in +6 -0
- sqlshell-0.2.0/sqlshell/README.md +59 -0
- sqlshell-0.2.0/sqlshell/context_suggester.py +765 -0
- sqlshell-0.2.0/sqlshell/create_test_data.py +126 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/db/database_manager.py +152 -6
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/editor.py +68 -11
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/main.py +1566 -656
- sqlshell-0.2.0/sqlshell/menus.py +171 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/query_tab.py +32 -3
- sqlshell-0.2.0/sqlshell/styles.py +257 -0
- sqlshell-0.2.0/sqlshell/suggester_integration.py +275 -0
- sqlshell-0.2.0/sqlshell/table_list.py +907 -0
- sqlshell-0.2.0/sqlshell/utils/__init__.py +8 -0
- sqlshell-0.2.0/sqlshell/utils/profile_entropy.py +347 -0
- sqlshell-0.2.0/sqlshell/utils/profile_keys.py +356 -0
- sqlshell-0.2.0/sqlshell.egg-info/PKG-INFO +198 -0
- sqlshell-0.2.0/sqlshell.egg-info/SOURCES.txt +51 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell.egg-info/requires.txt +2 -0
- sqlshell-0.2.0/sqlshell_demo.png +0 -0
- sqlshell-0.2.0/sqlshell_logo.png +0 -0
- sqlshell-0.1.9/MANIFEST.in +0 -10
- sqlshell-0.1.9/PKG-INFO +0 -122
- sqlshell-0.1.9/README.md +0 -93
- sqlshell-0.1.9/pool.db +0 -0
- sqlshell-0.1.9/setup.py +0 -57
- sqlshell-0.1.9/sqlshell/create_test_data.py +0 -50
- sqlshell-0.1.9/sqlshell/setup.py +0 -42
- sqlshell-0.1.9/sqlshell.egg-info/PKG-INFO +0 -122
- sqlshell-0.1.9/sqlshell.egg-info/SOURCES.txt +0 -76
- sqlshell-0.1.9/sqlshell_demo.png +0 -0
- sqlshell-0.1.9/sqlshell_logo.png +0 -0
- sqlshell-0.1.9/test_data/by_category.parquet +0 -0
- sqlshell-0.1.9/test_data/city_coordinates.csv +0 -9
- sqlshell-0.1.9/test_data/city_coordinates.parquet +0 -0
- sqlshell-0.1.9/test_data/city_coordinates.xlsx +0 -0
- sqlshell-0.1.9/test_data/customer_data.csv +0 -101
- sqlshell-0.1.9/test_data/customer_data.parquet +0 -0
- sqlshell-0.1.9/test_data/customer_data.xlsx +0 -0
- sqlshell-0.1.9/test_data/customers_by_country.parquet +0 -0
- sqlshell-0.1.9/test_data/delete_me.parquet +0 -0
- sqlshell-0.1.9/test_data/joined_test.parquet +0 -0
- sqlshell-0.1.9/test_data/price_by_category.parquet +0 -0
- sqlshell-0.1.9/test_data/product_catalog.csv +0 -51
- sqlshell-0.1.9/test_data/product_catalog.parquet +0 -0
- sqlshell-0.1.9/test_data/product_catalog.xlsx +0 -0
- sqlshell-0.1.9/test_data/product_categories.csv +0 -81
- sqlshell-0.1.9/test_data/product_categories.parquet +0 -0
- sqlshell-0.1.9/test_data/product_categories.xlsx +0 -0
- sqlshell-0.1.9/test_data/s1.parquet +0 -0
- sqlshell-0.1.9/test_data/sample_sales_data.csv +0 -1001
- sqlshell-0.1.9/test_data/sample_sales_data.parquet +0 -0
- sqlshell-0.1.9/test_data/sample_sales_data.xlsx +0 -0
- sqlshell-0.1.9/test_data/stock_data.csv +0 -101
- sqlshell-0.1.9/test_data/stock_data.parquet +0 -0
- sqlshell-0.1.9/test_data/stock_data.xlsx +0 -0
- sqlshell-0.1.9/test_data/test.db +0 -0
- sqlshell-0.1.9/test_data/test.duckdb +0 -0
- sqlshell-0.1.9/test_data/test2.parquet +0 -0
- sqlshell-0.1.9/test_data/test3.parquet +0 -0
- sqlshell-0.1.9/test_data/test3.xlsx +0 -0
- sqlshell-0.1.9/test_data/test4.xlsx +0 -0
- sqlshell-0.1.9/test_data/test5.xlsx +0 -0
- sqlshell-0.1.9/test_data/testproject.sqls +0 -139
- sqlshell-0.1.9/test_data/vaaaa.xlsx +0 -0
- sqlshell-0.1.9/test_data/weather_measurements.csv +0 -366
- sqlshell-0.1.9/test_data/weather_measurements.parquet +0 -0
- sqlshell-0.1.9/test_data/weather_measurements.xlsx +0 -0
- sqlshell-0.1.9/test_data/yo.parquet +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/setup.cfg +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/__init__.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/data/create_test_data.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/db/__init__.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/__init__.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/create_icon.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/create_splash.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/icon.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/logo_large.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/logo_medium.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/logo_small.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/resources/splash_screen.gif +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/splash_screen.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/sqlshell/__init__.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/sqlshell/create_test_data.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/sqlshell/create_test_databases.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/sqlshell_demo.png +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/syntax_highlighter.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/ui/__init__.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/ui/bar_chart_delegate.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell/ui/filter_header.py +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell.egg-info/dependency_links.txt +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell.egg-info/entry_points.txt +0 -0
- {sqlshell-0.1.9 → sqlshell-0.2.0}/sqlshell.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Test data files
|
|
24
|
+
tests/data/*.db
|
|
25
|
+
tests/data/*.parquet
|
|
26
|
+
tests/data/*.xlsx
|
|
27
|
+
tests/data/*.xls
|
|
28
|
+
tests/data/*.csv
|
|
29
|
+
tests/data/*.delta
|
|
30
|
+
tests/data/*.duckdb
|
|
31
|
+
tests/data/*.sqls
|
|
32
|
+
|
|
33
|
+
# IDE
|
|
34
|
+
.idea/
|
|
35
|
+
.vscode/
|
|
36
|
+
*.swp
|
|
37
|
+
*.swo
|
|
38
|
+
|
|
39
|
+
# Environment
|
|
40
|
+
.env
|
|
41
|
+
.venv
|
|
42
|
+
env/
|
|
43
|
+
venv/
|
|
44
|
+
ENV/
|
|
45
|
+
|
|
46
|
+
# Distribution
|
|
47
|
+
dist/
|
|
48
|
+
build/
|
|
49
|
+
*.egg-info/
|
|
50
|
+
|
|
51
|
+
# Generated files
|
|
52
|
+
*.log
|
|
53
|
+
.coverage
|
|
54
|
+
htmlcov/
|
|
55
|
+
|
|
56
|
+
# Virtual Environment
|
|
57
|
+
venv/
|
|
58
|
+
env/
|
|
59
|
+
ENV/
|
|
60
|
+
.env
|
|
61
|
+
.venv
|
|
62
|
+
|
|
63
|
+
# Project specific
|
|
64
|
+
*.db
|
|
65
|
+
*.xlsx
|
|
66
|
+
*.xls
|
|
67
|
+
*.csv
|
|
68
|
+
sample_sales_data.xlsx
|
|
69
|
+
pool.db
|
|
70
|
+
|
|
71
|
+
# Logs
|
|
72
|
+
*.log
|
|
73
|
+
logs/
|
|
74
|
+
|
|
75
|
+
# OS specific
|
|
76
|
+
.DS_Store
|
|
77
|
+
Thumbs.db
|
|
78
|
+
desktop.ini
|
|
79
|
+
|
|
80
|
+
# Distribution / packaging
|
|
81
|
+
*.spec
|
|
82
|
+
*.manifest
|
|
83
|
+
*.spec
|
|
84
|
+
*.parquet
|
|
85
|
+
*.sqls
|
|
86
|
+
sqlshell-0.2.0/
|
|
87
|
+
TODO
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include sqlshell_logo.png
|
|
4
|
+
include sqlshell_demo.png
|
|
5
|
+
include pool.db
|
|
6
|
+
include sqlshell/resources/*.png
|
|
7
|
+
include sqlshell/resources/*.gif
|
|
8
|
+
include sqlshell/data/*.py
|
|
9
|
+
global-exclude __pycache__
|
|
10
|
+
global-exclude *.py[cod]
|
|
11
|
+
global-exclude tests/data
|
|
12
|
+
global-exclude */tests/data
|
|
13
|
+
global-exclude *.db
|
|
14
|
+
global-exclude *.parquet
|
|
15
|
+
global-exclude *.xlsx
|
|
16
|
+
global-exclude *.xls
|
|
17
|
+
global-exclude *.csv
|
|
18
|
+
global-exclude *.delta
|
|
19
|
+
global-exclude test.duckdb
|
|
20
|
+
prune tests/data
|
sqlshell-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sqlshell
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: A powerful SQL shell with GUI interface for data analysis
|
|
5
|
+
Author: SQLShell Team
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/oyvinrog/SQLShell
|
|
8
|
+
Keywords: sql,data analysis,gui,duckdb
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: pandas>=2.0.0
|
|
19
|
+
Requires-Dist: numpy>=1.24.0
|
|
20
|
+
Requires-Dist: PyQt6>=6.4.0
|
|
21
|
+
Requires-Dist: duckdb>=0.9.0
|
|
22
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
23
|
+
Requires-Dist: pyarrow>=14.0.1
|
|
24
|
+
Requires-Dist: fastparquet>=2023.10.1
|
|
25
|
+
Requires-Dist: xlrd>=2.0.1
|
|
26
|
+
Requires-Dist: deltalake
|
|
27
|
+
Requires-Dist: Pillow>=10.0.0
|
|
28
|
+
|
|
29
|
+
# SQLShell
|
|
30
|
+
|
|
31
|
+
<div align="center">
|
|
32
|
+
|
|
33
|
+
<img src="sqlshell_logo.png" alt="SQLShell Logo" width="180" height="auto">
|
|
34
|
+
|
|
35
|
+
**A powerful SQL shell with GUI interface for data analysis**
|
|
36
|
+
|
|
37
|
+
<img src="sqlshell_demo.png" alt="SQLShell Interface" width="80%" height="auto">
|
|
38
|
+
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
## 🚀 Key Features
|
|
42
|
+
|
|
43
|
+
- **Interactive SQL Interface** - Rich syntax highlighting for enhanced query writing
|
|
44
|
+
- **Context-Aware Suggestions** - Intelligent SQL autocompletion based on query context and schema
|
|
45
|
+
- **DuckDB Integration** - Powerful analytical queries powered by DuckDB
|
|
46
|
+
- **Multi-Format Support** - Import and query Excel (.xlsx, .xls), CSV, and Parquet files effortlessly
|
|
47
|
+
- **Modern UI** - Clean, tabular results display with intuitive controls
|
|
48
|
+
- **Table Preview** - Quick view of imported data tables
|
|
49
|
+
- **Test Data Generation** - Built-in sample data for testing and learning
|
|
50
|
+
- **Multiple Views** - Support for multiple concurrent table views
|
|
51
|
+
- **Productivity Tools** - Streamlined workflow with keyboard shortcuts (e.g., Ctrl+Enter for query execution)
|
|
52
|
+
|
|
53
|
+
## 📦 Installation
|
|
54
|
+
|
|
55
|
+
### Using pip (Recommended)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install sqlshell
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Linux Setup with Virtual Environment
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Create and activate virtual environment
|
|
65
|
+
python3 -m venv ~/.venv/sqlshell
|
|
66
|
+
source ~/.venv/sqlshell/bin/activate
|
|
67
|
+
|
|
68
|
+
# Install SQLShell
|
|
69
|
+
pip install sqlshell
|
|
70
|
+
|
|
71
|
+
# Configure shell alias
|
|
72
|
+
echo 'alias sqls="~/.venv/sqlshell/bin/sqls"' >> ~/.bashrc # or ~/.zshrc for Zsh
|
|
73
|
+
source ~/.bashrc # or source ~/.zshrc
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Development Installation
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git clone https://github.com/oyvinrog/SQLShell.git
|
|
80
|
+
cd SQLShell
|
|
81
|
+
pip install -e .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 🎯 Getting Started
|
|
85
|
+
|
|
86
|
+
1. **Launch the Application**
|
|
87
|
+
```bash
|
|
88
|
+
sqls
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
If the `sqls` command doesn't work (e.g., "access denied" on Windows), you can use this alternative:
|
|
92
|
+
```bash
|
|
93
|
+
python -c "import sqlshell; sqlshell.start()"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
2. **Database Connection**
|
|
97
|
+
- SQLShell automatically connects to a local DuckDB database named 'pool.db'
|
|
98
|
+
|
|
99
|
+
3. **Working with Data Files**
|
|
100
|
+
- Click "Load Files" to select your Excel, CSV, or Parquet files
|
|
101
|
+
- File contents are loaded as queryable SQL tables
|
|
102
|
+
- Query using standard SQL syntax
|
|
103
|
+
|
|
104
|
+
4. **Query Execution**
|
|
105
|
+
- Enter SQL in the editor
|
|
106
|
+
- Execute using Ctrl+Enter or the "Execute" button
|
|
107
|
+
- View results in the structured output panel
|
|
108
|
+
|
|
109
|
+
5. **Test Data**
|
|
110
|
+
- Load sample test data using the "Test" button for quick experimentation
|
|
111
|
+
|
|
112
|
+
6. **Using Context-Aware Suggestions**
|
|
113
|
+
- Press Ctrl+Space to manually trigger suggestions
|
|
114
|
+
- Suggestions appear automatically as you type
|
|
115
|
+
- Context-specific suggestions based on your query position:
|
|
116
|
+
- After SELECT: columns and functions
|
|
117
|
+
- After FROM/JOIN: tables with join conditions
|
|
118
|
+
- After WHERE: columns with appropriate operators
|
|
119
|
+
- Inside functions: relevant column suggestions
|
|
120
|
+
|
|
121
|
+
## 📝 Query Examples
|
|
122
|
+
|
|
123
|
+
### Basic Join Operation
|
|
124
|
+
```sql
|
|
125
|
+
SELECT *
|
|
126
|
+
FROM sample_sales_data cd
|
|
127
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid
|
|
128
|
+
LIMIT 3;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Multi-Statement Queries
|
|
132
|
+
```sql
|
|
133
|
+
-- Create a temporary view
|
|
134
|
+
CREATE OR REPLACE TEMPORARY VIEW test_v AS
|
|
135
|
+
SELECT *
|
|
136
|
+
FROM sample_sales_data cd
|
|
137
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid;
|
|
138
|
+
|
|
139
|
+
-- Query the view
|
|
140
|
+
SELECT DISTINCT productid
|
|
141
|
+
FROM test_v;
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 💡 Pro Tips
|
|
145
|
+
|
|
146
|
+
- Use temporary views for complex query organization
|
|
147
|
+
- Leverage keyboard shortcuts for efficient workflow
|
|
148
|
+
- Explore the multi-format support for various data sources
|
|
149
|
+
- Create multiple tabs for parallel query development
|
|
150
|
+
- The context-aware suggestions learn from your query patterns
|
|
151
|
+
- Type `table_name.` to see all columns for a specific table
|
|
152
|
+
- After JOIN keyword, the system suggests relevant tables and join conditions
|
|
153
|
+
|
|
154
|
+
## 📊 Column Profiler
|
|
155
|
+
|
|
156
|
+
The Column Profiler provides quick statistical insights into your table columns:
|
|
157
|
+
|
|
158
|
+
<img src="column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
159
|
+
|
|
160
|
+
### Using the Column Profiler
|
|
161
|
+
|
|
162
|
+
1. **Access the Profiler**
|
|
163
|
+
- Right-click on any table in the schema browser
|
|
164
|
+
- Select "Profile Table" from the context menu
|
|
165
|
+
|
|
166
|
+
2. **View Column Statistics**
|
|
167
|
+
- Instantly see key metrics for each column:
|
|
168
|
+
- Data type
|
|
169
|
+
- Non-null count and percentage
|
|
170
|
+
- Unique values count
|
|
171
|
+
- Mean, median, min, and max values (for numeric columns)
|
|
172
|
+
- Most frequent values and their counts
|
|
173
|
+
- Distribution visualization
|
|
174
|
+
|
|
175
|
+
3. **Benefits**
|
|
176
|
+
- Quickly understand data distribution
|
|
177
|
+
- Identify outliers and data quality issues
|
|
178
|
+
- Make informed decisions about query conditions
|
|
179
|
+
- Assess column cardinality for join operations
|
|
180
|
+
|
|
181
|
+
The Column Profiler is an invaluable tool for exploratory data analysis, helping you gain insights before writing complex queries.
|
|
182
|
+
|
|
183
|
+
## 📋 Requirements
|
|
184
|
+
|
|
185
|
+
- Python 3.8 or higher
|
|
186
|
+
- Dependencies (automatically installed):
|
|
187
|
+
- PyQt6 ≥ 6.4.0
|
|
188
|
+
- DuckDB ≥ 0.9.0
|
|
189
|
+
- Pandas ≥ 2.0.0
|
|
190
|
+
- NumPy ≥ 1.24.0
|
|
191
|
+
- openpyxl ≥ 3.1.0 (Excel support)
|
|
192
|
+
- pyarrow ≥ 14.0.1 (Parquet support)
|
|
193
|
+
- fastparquet ≥ 2023.10.1 (Alternative parquet engine)
|
|
194
|
+
- xlrd ≥ 2.0.1 (Support for older .xls files)
|
|
195
|
+
|
|
196
|
+
## 📄 License
|
|
197
|
+
|
|
198
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
sqlshell-0.2.0/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# SQLShell
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<img src="sqlshell_logo.png" alt="SQLShell Logo" width="180" height="auto">
|
|
6
|
+
|
|
7
|
+
**A powerful SQL shell with GUI interface for data analysis**
|
|
8
|
+
|
|
9
|
+
<img src="sqlshell_demo.png" alt="SQLShell Interface" width="80%" height="auto">
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## 🚀 Key Features
|
|
14
|
+
|
|
15
|
+
- **Interactive SQL Interface** - Rich syntax highlighting for enhanced query writing
|
|
16
|
+
- **Context-Aware Suggestions** - Intelligent SQL autocompletion based on query context and schema
|
|
17
|
+
- **DuckDB Integration** - Powerful analytical queries powered by DuckDB
|
|
18
|
+
- **Multi-Format Support** - Import and query Excel (.xlsx, .xls), CSV, and Parquet files effortlessly
|
|
19
|
+
- **Modern UI** - Clean, tabular results display with intuitive controls
|
|
20
|
+
- **Table Preview** - Quick view of imported data tables
|
|
21
|
+
- **Test Data Generation** - Built-in sample data for testing and learning
|
|
22
|
+
- **Multiple Views** - Support for multiple concurrent table views
|
|
23
|
+
- **Productivity Tools** - Streamlined workflow with keyboard shortcuts (e.g., Ctrl+Enter for query execution)
|
|
24
|
+
|
|
25
|
+
## 📦 Installation
|
|
26
|
+
|
|
27
|
+
### Using pip (Recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install sqlshell
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Linux Setup with Virtual Environment
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Create and activate virtual environment
|
|
37
|
+
python3 -m venv ~/.venv/sqlshell
|
|
38
|
+
source ~/.venv/sqlshell/bin/activate
|
|
39
|
+
|
|
40
|
+
# Install SQLShell
|
|
41
|
+
pip install sqlshell
|
|
42
|
+
|
|
43
|
+
# Configure shell alias
|
|
44
|
+
echo 'alias sqls="~/.venv/sqlshell/bin/sqls"' >> ~/.bashrc # or ~/.zshrc for Zsh
|
|
45
|
+
source ~/.bashrc # or source ~/.zshrc
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Development Installation
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
git clone https://github.com/oyvinrog/SQLShell.git
|
|
52
|
+
cd SQLShell
|
|
53
|
+
pip install -e .
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 🎯 Getting Started
|
|
57
|
+
|
|
58
|
+
1. **Launch the Application**
|
|
59
|
+
```bash
|
|
60
|
+
sqls
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If the `sqls` command doesn't work (e.g., "access denied" on Windows), you can use this alternative:
|
|
64
|
+
```bash
|
|
65
|
+
python -c "import sqlshell; sqlshell.start()"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. **Database Connection**
|
|
69
|
+
- SQLShell automatically connects to a local DuckDB database named 'pool.db'
|
|
70
|
+
|
|
71
|
+
3. **Working with Data Files**
|
|
72
|
+
- Click "Load Files" to select your Excel, CSV, or Parquet files
|
|
73
|
+
- File contents are loaded as queryable SQL tables
|
|
74
|
+
- Query using standard SQL syntax
|
|
75
|
+
|
|
76
|
+
4. **Query Execution**
|
|
77
|
+
- Enter SQL in the editor
|
|
78
|
+
- Execute using Ctrl+Enter or the "Execute" button
|
|
79
|
+
- View results in the structured output panel
|
|
80
|
+
|
|
81
|
+
5. **Test Data**
|
|
82
|
+
- Load sample test data using the "Test" button for quick experimentation
|
|
83
|
+
|
|
84
|
+
6. **Using Context-Aware Suggestions**
|
|
85
|
+
- Press Ctrl+Space to manually trigger suggestions
|
|
86
|
+
- Suggestions appear automatically as you type
|
|
87
|
+
- Context-specific suggestions based on your query position:
|
|
88
|
+
- After SELECT: columns and functions
|
|
89
|
+
- After FROM/JOIN: tables with join conditions
|
|
90
|
+
- After WHERE: columns with appropriate operators
|
|
91
|
+
- Inside functions: relevant column suggestions
|
|
92
|
+
|
|
93
|
+
## 📝 Query Examples
|
|
94
|
+
|
|
95
|
+
### Basic Join Operation
|
|
96
|
+
```sql
|
|
97
|
+
SELECT *
|
|
98
|
+
FROM sample_sales_data cd
|
|
99
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid
|
|
100
|
+
LIMIT 3;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Multi-Statement Queries
|
|
104
|
+
```sql
|
|
105
|
+
-- Create a temporary view
|
|
106
|
+
CREATE OR REPLACE TEMPORARY VIEW test_v AS
|
|
107
|
+
SELECT *
|
|
108
|
+
FROM sample_sales_data cd
|
|
109
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid;
|
|
110
|
+
|
|
111
|
+
-- Query the view
|
|
112
|
+
SELECT DISTINCT productid
|
|
113
|
+
FROM test_v;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 💡 Pro Tips
|
|
117
|
+
|
|
118
|
+
- Use temporary views for complex query organization
|
|
119
|
+
- Leverage keyboard shortcuts for efficient workflow
|
|
120
|
+
- Explore the multi-format support for various data sources
|
|
121
|
+
- Create multiple tabs for parallel query development
|
|
122
|
+
- The context-aware suggestions learn from your query patterns
|
|
123
|
+
- Type `table_name.` to see all columns for a specific table
|
|
124
|
+
- After JOIN keyword, the system suggests relevant tables and join conditions
|
|
125
|
+
|
|
126
|
+
## 📊 Column Profiler
|
|
127
|
+
|
|
128
|
+
The Column Profiler provides quick statistical insights into your table columns:
|
|
129
|
+
|
|
130
|
+
<img src="column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
131
|
+
|
|
132
|
+
### Using the Column Profiler
|
|
133
|
+
|
|
134
|
+
1. **Access the Profiler**
|
|
135
|
+
- Right-click on any table in the schema browser
|
|
136
|
+
- Select "Profile Table" from the context menu
|
|
137
|
+
|
|
138
|
+
2. **View Column Statistics**
|
|
139
|
+
- Instantly see key metrics for each column:
|
|
140
|
+
- Data type
|
|
141
|
+
- Non-null count and percentage
|
|
142
|
+
- Unique values count
|
|
143
|
+
- Mean, median, min, and max values (for numeric columns)
|
|
144
|
+
- Most frequent values and their counts
|
|
145
|
+
- Distribution visualization
|
|
146
|
+
|
|
147
|
+
3. **Benefits**
|
|
148
|
+
- Quickly understand data distribution
|
|
149
|
+
- Identify outliers and data quality issues
|
|
150
|
+
- Make informed decisions about query conditions
|
|
151
|
+
- Assess column cardinality for join operations
|
|
152
|
+
|
|
153
|
+
The Column Profiler is an invaluable tool for exploratory data analysis, helping you gain insights before writing complex queries.
|
|
154
|
+
|
|
155
|
+
## 📋 Requirements
|
|
156
|
+
|
|
157
|
+
- Python 3.8 or higher
|
|
158
|
+
- Dependencies (automatically installed):
|
|
159
|
+
- PyQt6 ≥ 6.4.0
|
|
160
|
+
- DuckDB ≥ 0.9.0
|
|
161
|
+
- Pandas ≥ 2.0.0
|
|
162
|
+
- NumPy ≥ 1.24.0
|
|
163
|
+
- openpyxl ≥ 3.1.0 (Excel support)
|
|
164
|
+
- pyarrow ≥ 14.0.1 (Parquet support)
|
|
165
|
+
- fastparquet ≥ 2023.10.1 (Alternative parquet engine)
|
|
166
|
+
- xlrd ≥ 2.0.1 (Support for older .xls files)
|
|
167
|
+
|
|
168
|
+
## 📄 License
|
|
169
|
+
|
|
170
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
Binary file
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel>=0.37.0", "setuptools_scm>=6.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sqlshell"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "A powerful SQL shell with GUI interface for data analysis"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
]
|
|
13
13
|
requires-python = ">=3.8"
|
|
14
14
|
keywords = ["sql", "data analysis", "gui", "duckdb"]
|
|
15
|
-
license =
|
|
15
|
+
license = "MIT"
|
|
16
16
|
classifiers = [
|
|
17
17
|
"Development Status :: 3 - Alpha",
|
|
18
18
|
"Intended Audience :: Developers",
|
|
@@ -30,11 +30,41 @@ dependencies = [
|
|
|
30
30
|
"openpyxl>=3.1.0",
|
|
31
31
|
"pyarrow>=14.0.1",
|
|
32
32
|
"fastparquet>=2023.10.1",
|
|
33
|
-
"xlrd>=2.0.1"
|
|
33
|
+
"xlrd>=2.0.1",
|
|
34
|
+
"deltalake",
|
|
35
|
+
"Pillow>=10.0.0"
|
|
34
36
|
]
|
|
35
37
|
|
|
36
38
|
[project.urls]
|
|
37
39
|
Homepage = "https://github.com/oyvinrog/SQLShell"
|
|
38
40
|
|
|
39
41
|
[project.scripts]
|
|
40
|
-
sqls = "sqlshell.main:main"
|
|
42
|
+
sqls = "sqlshell.main:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools]
|
|
45
|
+
packages = [
|
|
46
|
+
"sqlshell",
|
|
47
|
+
"sqlshell.data",
|
|
48
|
+
"sqlshell.db",
|
|
49
|
+
"sqlshell.resources",
|
|
50
|
+
"sqlshell.sqlshell",
|
|
51
|
+
"sqlshell.ui",
|
|
52
|
+
"sqlshell.utils"
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.package-data]
|
|
56
|
+
sqlshell = [
|
|
57
|
+
"*.db",
|
|
58
|
+
"resources/*.png",
|
|
59
|
+
"resources/*.gif",
|
|
60
|
+
"data/*.py",
|
|
61
|
+
"*.png",
|
|
62
|
+
"*.ico"
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.setuptools.exclude-package-data]
|
|
66
|
+
sqlshell = [
|
|
67
|
+
"tests/*",
|
|
68
|
+
"*/tests/*",
|
|
69
|
+
"tests/data/*"
|
|
70
|
+
]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pandas>=2.0.0
|
|
2
|
+
numpy>=1.24.0
|
|
3
|
+
PyQt6>=6.4.0
|
|
4
|
+
duckdb>=0.9.0
|
|
5
|
+
openpyxl>=3.1.0 # For Excel support
|
|
6
|
+
pyarrow # For parquet support
|
|
7
|
+
fastparquet>=2023.10.1 # Alternative parquet engine
|
|
8
|
+
xlrd>=2.0.1 # For old .xls files
|
|
9
|
+
deltalake # For Delta Lake table support
|
|
10
|
+
Pillow>=10.0.0 # For image processing (used in splash screen and icon creation)
|
sqlshell-0.2.0/run.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
SQLShell - A powerful SQL shell with GUI interface for data analysis
|
|
4
|
+
|
|
5
|
+
This is the main entry point for the application. You can start SQLShell in two ways:
|
|
6
|
+
|
|
7
|
+
1. Normal way (if 'sqls' command works):
|
|
8
|
+
sqls
|
|
9
|
+
|
|
10
|
+
2. Alternative way (if 'sqls' command leads to "access denied" on Windows):
|
|
11
|
+
python -c "import sqlshell; sqlshell.start()"
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
# Add the project root directory to Python path
|
|
18
|
+
project_root = os.path.dirname(os.path.abspath(__file__))
|
|
19
|
+
sys.path.insert(0, project_root)
|
|
20
|
+
|
|
21
|
+
from sqlshell.main import main
|
|
22
|
+
|
|
23
|
+
def start():
|
|
24
|
+
"""Start the SQLShell application.
|
|
25
|
+
This function is provided for Windows compatibility when the 'sqls' command doesn't work."""
|
|
26
|
+
main()
|
|
27
|
+
|
|
28
|
+
if __name__ == '__main__':
|
|
29
|
+
main()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 SQLShell Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# SQLShell
|
|
2
|
+
|
|
3
|
+
A powerful SQL shell with GUI interface for data analysis. SQLShell provides an intuitive interface for working with various data formats (CSV, Excel, Parquet) using SQL queries powered by DuckDB.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Load and analyze data from CSV, Excel (.xlsx, .xls), and Parquet files
|
|
10
|
+
- Interactive GUI with syntax highlighting
|
|
11
|
+
- Real-time query results
|
|
12
|
+
- Table preview functionality
|
|
13
|
+
- Built-in test data generation
|
|
14
|
+
- Support for multiple concurrent table views
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
You can install SQLShell using pip:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install sqlshell
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
refer to
|
|
25
|
+
|
|
26
|
+
For development installation:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/oyvinrog/SQLShell.git
|
|
30
|
+
cd sqlshell
|
|
31
|
+
pip install -e .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
After installation, you can start SQLShell from anywhere in your terminal by running:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
sqls
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This will open the GUI interface where you can:
|
|
43
|
+
1. Load data files using the "Load Files" button
|
|
44
|
+
2. Write SQL queries in the query editor
|
|
45
|
+
3. Execute queries using the "Execute" button or Ctrl+Enter
|
|
46
|
+
4. View results in the table view below
|
|
47
|
+
5. Load sample test data using the "Test" button
|
|
48
|
+
|
|
49
|
+
## Requirements
|
|
50
|
+
|
|
51
|
+
- Python 3.8 or higher
|
|
52
|
+
- PyQt6
|
|
53
|
+
- DuckDB
|
|
54
|
+
- Pandas
|
|
55
|
+
- Other dependencies will be automatically installed
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|