sqlshell 0.2.2__tar.gz → 0.2.3__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/PKG-INFO +281 -0
- sqlshell-0.2.3/README.md +248 -0
- {sqlshell-0.2.2/sqlshell → sqlshell-0.2.3}/main.py +214 -3
- {sqlshell-0.2.2 → sqlshell-0.2.3}/pyproject.toml +7 -2
- {sqlshell-0.2.2 → sqlshell-0.2.3}/requirements.txt +6 -1
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/README.md +5 -1
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/__init__.py +1 -1
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/create_test_data.py +29 -0
- sqlshell-0.2.3/sqlshell/main.py +3537 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/table_list.py +90 -1
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/ui/filter_header.py +14 -0
- sqlshell-0.2.3/sqlshell/utils/profile_column.py +1099 -0
- sqlshell-0.2.3/sqlshell/utils/profile_distributions.py +613 -0
- sqlshell-0.2.3/sqlshell/utils/profile_foreign_keys.py +455 -0
- sqlshell-0.2.3/sqlshell.egg-info/PKG-INFO +281 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell.egg-info/SOURCES.txt +4 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell.egg-info/requires.txt +5 -0
- sqlshell-0.2.2/PKG-INFO +0 -198
- sqlshell-0.2.2/README.md +0 -170
- sqlshell-0.2.2/sqlshell.egg-info/PKG-INFO +0 -198
- {sqlshell-0.2.2 → sqlshell-0.2.3}/.gitignore +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/MANIFEST.in +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/column_profiler.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/run.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/setup.cfg +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/LICENSE +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/MANIFEST.in +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/context_suggester.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/data/create_test_data.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/db/__init__.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/db/database_manager.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/editor.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/menus.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/query_tab.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/__init__.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/create_icon.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/create_splash.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/icon.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/logo_large.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/logo_medium.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/logo_small.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/resources/splash_screen.gif +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/splash_screen.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/sqlshell/__init__.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/sqlshell/create_test_data.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/sqlshell/create_test_databases.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/sqlshell_demo.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/styles.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/suggester_integration.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/syntax_highlighter.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/ui/__init__.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/ui/bar_chart_delegate.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/utils/__init__.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/utils/profile_entropy.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell/utils/profile_keys.py +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell.egg-info/dependency_links.txt +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell.egg-info/entry_points.txt +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell.egg-info/top_level.txt +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell_demo.png +0 -0
- {sqlshell-0.2.2 → sqlshell-0.2.3}/sqlshell_logo.png +0 -0
sqlshell-0.2.3/PKG-INFO
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sqlshell
|
|
3
|
+
Version: 0.2.3
|
|
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
|
+
Requires-Dist: shap
|
|
29
|
+
Requires-Dist: xgboost
|
|
30
|
+
Requires-Dist: scikit-learn
|
|
31
|
+
Requires-Dist: matplotlib>=3.10.0
|
|
32
|
+
Requires-Dist: scipy>=1.15.0
|
|
33
|
+
|
|
34
|
+
# SQLShell
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
|
|
38
|
+
<img src="https://github.com/oyvinrog/SQLShell/raw/main/sqlshell_logo.png" alt="SQLShell Logo" width="180" height="auto">
|
|
39
|
+
|
|
40
|
+
**A powerful SQL shell with GUI interface for data analysis**
|
|
41
|
+
|
|
42
|
+
<img src="https://github.com/oyvinrog/SQLShell/raw/main/sqlshell_demo.png" alt="SQLShell Interface" width="80%" height="auto">
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
## 🚀 Key Features
|
|
47
|
+
|
|
48
|
+
- **Interactive SQL Interface** - Rich syntax highlighting for enhanced query writing
|
|
49
|
+
- **Context-Aware Suggestions** - Intelligent SQL autocompletion based on query context and schema
|
|
50
|
+
- **DuckDB Integration** - Powerful analytical queries powered by DuckDB
|
|
51
|
+
- **Multi-Format Support** - Import and query Excel (.xlsx, .xls), CSV, and Parquet files effortlessly
|
|
52
|
+
- **Modern UI** - Clean, tabular results display with intuitive controls
|
|
53
|
+
- **Table Preview** - Quick view of imported data tables
|
|
54
|
+
- **Test Data Generation** - Built-in sample data for testing and learning
|
|
55
|
+
- **Multiple Views** - Support for multiple concurrent table views
|
|
56
|
+
- **Productivity Tools** - Streamlined workflow with keyboard shortcuts (e.g., Ctrl+Enter for query execution)
|
|
57
|
+
- **Explain Column** - Analyze relationships between data columns directly from query results
|
|
58
|
+
|
|
59
|
+
## 📦 Installation
|
|
60
|
+
|
|
61
|
+
### Using pip (Recommended)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install sqlshell
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Linux Setup with Virtual Environment
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Create and activate virtual environment
|
|
71
|
+
python3 -m venv ~/.venv/sqlshell
|
|
72
|
+
source ~/.venv/sqlshell/bin/activate
|
|
73
|
+
|
|
74
|
+
# Install SQLShell
|
|
75
|
+
pip install sqlshell
|
|
76
|
+
|
|
77
|
+
# Configure shell alias
|
|
78
|
+
echo 'alias sqls="~/.venv/sqlshell/bin/sqls"' >> ~/.bashrc # or ~/.zshrc for Zsh
|
|
79
|
+
source ~/.bashrc # or source ~/.zshrc
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Development Installation
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/oyvinrog/SQLShell.git
|
|
86
|
+
cd SQLShell
|
|
87
|
+
pip install -e .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 🎯 Getting Started
|
|
91
|
+
|
|
92
|
+
1. **Launch the Application**
|
|
93
|
+
```bash
|
|
94
|
+
sqls
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If the `sqls` command doesn't work (e.g., "access denied" on Windows), you can use this alternative:
|
|
98
|
+
```bash
|
|
99
|
+
python -c "import sqlshell; sqlshell.start()"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
2. **Database Connection**
|
|
103
|
+
- SQLShell automatically connects to a local DuckDB database named 'pool.db'
|
|
104
|
+
|
|
105
|
+
3. **Working with Data Files**
|
|
106
|
+
- Click "Load Files" to select your Excel, CSV, or Parquet files
|
|
107
|
+
- File contents are loaded as queryable SQL tables
|
|
108
|
+
- Query using standard SQL syntax
|
|
109
|
+
|
|
110
|
+
4. **Query Execution**
|
|
111
|
+
- Enter SQL in the editor
|
|
112
|
+
- Execute using Ctrl+Enter or the "Execute" button
|
|
113
|
+
- View results in the structured output panel
|
|
114
|
+
|
|
115
|
+
5. **Test Data**
|
|
116
|
+
- Load sample test data using the "Test" button for quick experimentation
|
|
117
|
+
|
|
118
|
+
6. **Using Context-Aware Suggestions**
|
|
119
|
+
- Press Ctrl+Space to manually trigger suggestions
|
|
120
|
+
- Suggestions appear automatically as you type
|
|
121
|
+
- Context-specific suggestions based on your query position:
|
|
122
|
+
- After SELECT: columns and functions
|
|
123
|
+
- After FROM/JOIN: tables with join conditions
|
|
124
|
+
- After WHERE: columns with appropriate operators
|
|
125
|
+
- Inside functions: relevant column suggestions
|
|
126
|
+
|
|
127
|
+
7. **Column Analysis**
|
|
128
|
+
- Right-click on column headers in the results pane
|
|
129
|
+
- Access features like sorting, filtering, and the "Explain Column" analysis tool
|
|
130
|
+
|
|
131
|
+
## 📝 Query Examples
|
|
132
|
+
|
|
133
|
+
### Basic Join Operation
|
|
134
|
+
```sql
|
|
135
|
+
SELECT *
|
|
136
|
+
FROM sample_sales_data cd
|
|
137
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid
|
|
138
|
+
LIMIT 3;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Multi-Statement Queries
|
|
142
|
+
```sql
|
|
143
|
+
-- Create a temporary view
|
|
144
|
+
CREATE OR REPLACE TEMPORARY VIEW test_v AS
|
|
145
|
+
SELECT *
|
|
146
|
+
FROM sample_sales_data cd
|
|
147
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid;
|
|
148
|
+
|
|
149
|
+
-- Query the view
|
|
150
|
+
SELECT DISTINCT productid
|
|
151
|
+
FROM test_v;
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 💡 Pro Tips
|
|
155
|
+
|
|
156
|
+
- Use temporary views for complex query organization
|
|
157
|
+
- Leverage keyboard shortcuts for efficient workflow
|
|
158
|
+
- Explore the multi-format support for various data sources
|
|
159
|
+
- Create multiple tabs for parallel query development
|
|
160
|
+
- The context-aware suggestions learn from your query patterns
|
|
161
|
+
- Type `table_name.` to see all columns for a specific table
|
|
162
|
+
- After JOIN keyword, the system suggests relevant tables and join conditions
|
|
163
|
+
|
|
164
|
+
## 📊 Table Profiling
|
|
165
|
+
|
|
166
|
+
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
|
+
|
|
168
|
+
<div align="center">
|
|
169
|
+
<img src="https://github.com/oyvinrog/SQLShell/raw/main/column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
### Table Profiling Options
|
|
173
|
+
|
|
174
|
+
Right-click on any table in the left panel to access these profiling tools:
|
|
175
|
+
|
|
176
|
+
1. **Analyze Column Importance**
|
|
177
|
+
- Calculates entropy for each column to identify the most information-rich fields
|
|
178
|
+
- Visualizes column importance with color-coded bars
|
|
179
|
+
- Helps identify which columns are most useful for analysis and modeling
|
|
180
|
+
|
|
181
|
+
2. **Profile Table Structure**
|
|
182
|
+
- Identifies candidate keys and functional dependencies
|
|
183
|
+
- Discovers potential primary keys and relationships between columns
|
|
184
|
+
- Suggests possible normalized table structures
|
|
185
|
+
- Helps understand table organization and optimize schema design
|
|
186
|
+
|
|
187
|
+
3. **Analyze Column Distributions**
|
|
188
|
+
- Generates histograms, box plots, and other statistical visualizations
|
|
189
|
+
- Identifies the distribution pattern of each column (normal, uniform, etc.)
|
|
190
|
+
- Provides detailed statistics like min, max, mean, median, skewness
|
|
191
|
+
- Helps identify outliers and understand data patterns
|
|
192
|
+
|
|
193
|
+
4. **Analyze Foreign Keys** (multi-table selection)
|
|
194
|
+
- Select multiple tables by holding Ctrl or Shift while clicking
|
|
195
|
+
- Right-click to access "Analyze Foreign Keys Between X Tables"
|
|
196
|
+
- Automatically discovers potential foreign key relationships between tables
|
|
197
|
+
- Identifies matching columns that could serve as join conditions
|
|
198
|
+
- Helps understand cross-table relationships in your data model
|
|
199
|
+
|
|
200
|
+
### Using the Profilers
|
|
201
|
+
|
|
202
|
+
1. **Access the Profilers**
|
|
203
|
+
- Right-click on any table in the schema browser
|
|
204
|
+
- Select the desired profiling option from the context menu
|
|
205
|
+
- For foreign key analysis, select multiple tables first
|
|
206
|
+
|
|
207
|
+
2. **Interpret the Results**
|
|
208
|
+
- Each profiler provides interactive visualizations
|
|
209
|
+
- Hover over charts for detailed information
|
|
210
|
+
- Switch between different views using the tabs
|
|
211
|
+
- Sort and filter results to focus on specific columns
|
|
212
|
+
|
|
213
|
+
3. **Benefits**
|
|
214
|
+
- Quickly understand data composition without writing queries
|
|
215
|
+
- Identify data quality issues and outliers
|
|
216
|
+
- Discover relationships between columns
|
|
217
|
+
- Make informed decisions about query optimization
|
|
218
|
+
|
|
219
|
+
The table profiling tools are invaluable for exploratory data analysis, helping you gain insights before writing complex queries.
|
|
220
|
+
|
|
221
|
+
## 📊 Column Analysis
|
|
222
|
+
|
|
223
|
+
SQLShell provides powerful tools to analyze individual columns directly from your query results:
|
|
224
|
+
|
|
225
|
+
### Explain Column Feature
|
|
226
|
+
|
|
227
|
+
The "Explain Column" feature helps you understand the relationships between columns in your query results:
|
|
228
|
+
|
|
229
|
+
1. **How to Access**:
|
|
230
|
+
- Right-click on any column header in the query results table
|
|
231
|
+
- Select "Explain Column" from the context menu
|
|
232
|
+
|
|
233
|
+
2. **What It Does**:
|
|
234
|
+
- Analyzes the selected column's relationship with other columns in the result set
|
|
235
|
+
- Identifies correlations and dependencies between columns
|
|
236
|
+
- Provides visualizations to help understand the column's importance and distribution
|
|
237
|
+
|
|
238
|
+
3. **Benefits**:
|
|
239
|
+
- Quickly identify which columns are most related to your target column
|
|
240
|
+
- Discover hidden patterns and relationships in your data
|
|
241
|
+
- Make data-driven decisions without writing complex analytical queries
|
|
242
|
+
|
|
243
|
+
### Multivariate Analysis Feature
|
|
244
|
+
|
|
245
|
+
The Column Profiler now offers in-depth multivariate analysis to explore relationships between columns:
|
|
246
|
+
|
|
247
|
+
1. **How to Access**:
|
|
248
|
+
- In the Column Profiler, double-click on any feature in the importance table
|
|
249
|
+
- A detailed visualization window will appear showing the relationship between the selected feature and the target column
|
|
250
|
+
|
|
251
|
+
2. **Smart Visualizations**:
|
|
252
|
+
- Automatically selects the most appropriate visualization based on data types:
|
|
253
|
+
- **Numeric vs. Numeric**: Scatter plot with regression line
|
|
254
|
+
- **Categorical vs. Numeric**: Bar chart showing average values
|
|
255
|
+
- **Numeric vs. Categorical**: Box plot showing distribution
|
|
256
|
+
- **Categorical vs. Categorical**: Heatmap showing relationship strength
|
|
257
|
+
|
|
258
|
+
3. **Benefits**:
|
|
259
|
+
- Gain deeper insights into how features relate to your target variable
|
|
260
|
+
- Understand which features have strong predictive relationships
|
|
261
|
+
- Identify patterns and outliers in multivariate relationships
|
|
262
|
+
- Make better decisions about feature selection for analysis and modeling
|
|
263
|
+
|
|
264
|
+
This feature is particularly useful for exploratory data analysis, helping you understand your data structure and relationships on the fly.
|
|
265
|
+
|
|
266
|
+
## 📋 Requirements
|
|
267
|
+
|
|
268
|
+
- Python 3.8 or higher
|
|
269
|
+
- Dependencies (automatically installed):
|
|
270
|
+
- PyQt6 ≥ 6.4.0
|
|
271
|
+
- DuckDB ≥ 0.9.0
|
|
272
|
+
- Pandas ≥ 2.0.0
|
|
273
|
+
- NumPy ≥ 1.24.0
|
|
274
|
+
- openpyxl ≥ 3.1.0 (Excel support)
|
|
275
|
+
- pyarrow ≥ 14.0.1 (Parquet support)
|
|
276
|
+
- fastparquet ≥ 2023.10.1 (Alternative parquet engine)
|
|
277
|
+
- xlrd ≥ 2.0.1 (Support for older .xls files)
|
|
278
|
+
|
|
279
|
+
## 📄 License
|
|
280
|
+
|
|
281
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
sqlshell-0.2.3/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# SQLShell
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
<img src="https://github.com/oyvinrog/SQLShell/raw/main/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="https://github.com/oyvinrog/SQLShell/raw/main/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
|
+
- **Explain Column** - Analyze relationships between data columns directly from query results
|
|
25
|
+
|
|
26
|
+
## 📦 Installation
|
|
27
|
+
|
|
28
|
+
### Using pip (Recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install sqlshell
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Linux Setup with Virtual Environment
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Create and activate virtual environment
|
|
38
|
+
python3 -m venv ~/.venv/sqlshell
|
|
39
|
+
source ~/.venv/sqlshell/bin/activate
|
|
40
|
+
|
|
41
|
+
# Install SQLShell
|
|
42
|
+
pip install sqlshell
|
|
43
|
+
|
|
44
|
+
# Configure shell alias
|
|
45
|
+
echo 'alias sqls="~/.venv/sqlshell/bin/sqls"' >> ~/.bashrc # or ~/.zshrc for Zsh
|
|
46
|
+
source ~/.bashrc # or source ~/.zshrc
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Development Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/oyvinrog/SQLShell.git
|
|
53
|
+
cd SQLShell
|
|
54
|
+
pip install -e .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 🎯 Getting Started
|
|
58
|
+
|
|
59
|
+
1. **Launch the Application**
|
|
60
|
+
```bash
|
|
61
|
+
sqls
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If the `sqls` command doesn't work (e.g., "access denied" on Windows), you can use this alternative:
|
|
65
|
+
```bash
|
|
66
|
+
python -c "import sqlshell; sqlshell.start()"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Database Connection**
|
|
70
|
+
- SQLShell automatically connects to a local DuckDB database named 'pool.db'
|
|
71
|
+
|
|
72
|
+
3. **Working with Data Files**
|
|
73
|
+
- Click "Load Files" to select your Excel, CSV, or Parquet files
|
|
74
|
+
- File contents are loaded as queryable SQL tables
|
|
75
|
+
- Query using standard SQL syntax
|
|
76
|
+
|
|
77
|
+
4. **Query Execution**
|
|
78
|
+
- Enter SQL in the editor
|
|
79
|
+
- Execute using Ctrl+Enter or the "Execute" button
|
|
80
|
+
- View results in the structured output panel
|
|
81
|
+
|
|
82
|
+
5. **Test Data**
|
|
83
|
+
- Load sample test data using the "Test" button for quick experimentation
|
|
84
|
+
|
|
85
|
+
6. **Using Context-Aware Suggestions**
|
|
86
|
+
- Press Ctrl+Space to manually trigger suggestions
|
|
87
|
+
- Suggestions appear automatically as you type
|
|
88
|
+
- Context-specific suggestions based on your query position:
|
|
89
|
+
- After SELECT: columns and functions
|
|
90
|
+
- After FROM/JOIN: tables with join conditions
|
|
91
|
+
- After WHERE: columns with appropriate operators
|
|
92
|
+
- Inside functions: relevant column suggestions
|
|
93
|
+
|
|
94
|
+
7. **Column Analysis**
|
|
95
|
+
- Right-click on column headers in the results pane
|
|
96
|
+
- Access features like sorting, filtering, and the "Explain Column" analysis tool
|
|
97
|
+
|
|
98
|
+
## 📝 Query Examples
|
|
99
|
+
|
|
100
|
+
### Basic Join Operation
|
|
101
|
+
```sql
|
|
102
|
+
SELECT *
|
|
103
|
+
FROM sample_sales_data cd
|
|
104
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid
|
|
105
|
+
LIMIT 3;
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Multi-Statement Queries
|
|
109
|
+
```sql
|
|
110
|
+
-- Create a temporary view
|
|
111
|
+
CREATE OR REPLACE TEMPORARY VIEW test_v AS
|
|
112
|
+
SELECT *
|
|
113
|
+
FROM sample_sales_data cd
|
|
114
|
+
INNER JOIN product_catalog pc ON pc.productid = cd.productid;
|
|
115
|
+
|
|
116
|
+
-- Query the view
|
|
117
|
+
SELECT DISTINCT productid
|
|
118
|
+
FROM test_v;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 💡 Pro Tips
|
|
122
|
+
|
|
123
|
+
- Use temporary views for complex query organization
|
|
124
|
+
- Leverage keyboard shortcuts for efficient workflow
|
|
125
|
+
- Explore the multi-format support for various data sources
|
|
126
|
+
- Create multiple tabs for parallel query development
|
|
127
|
+
- The context-aware suggestions learn from your query patterns
|
|
128
|
+
- Type `table_name.` to see all columns for a specific table
|
|
129
|
+
- After JOIN keyword, the system suggests relevant tables and join conditions
|
|
130
|
+
|
|
131
|
+
## 📊 Table Profiling
|
|
132
|
+
|
|
133
|
+
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
|
+
|
|
135
|
+
<div align="center">
|
|
136
|
+
<img src="https://github.com/oyvinrog/SQLShell/raw/main/column_profiler.png" alt="Column Profiler" width="80%" height="auto">
|
|
137
|
+
</div>
|
|
138
|
+
|
|
139
|
+
### Table Profiling Options
|
|
140
|
+
|
|
141
|
+
Right-click on any table in the left panel to access these profiling tools:
|
|
142
|
+
|
|
143
|
+
1. **Analyze Column Importance**
|
|
144
|
+
- Calculates entropy for each column to identify the most information-rich fields
|
|
145
|
+
- Visualizes column importance with color-coded bars
|
|
146
|
+
- Helps identify which columns are most useful for analysis and modeling
|
|
147
|
+
|
|
148
|
+
2. **Profile Table Structure**
|
|
149
|
+
- Identifies candidate keys and functional dependencies
|
|
150
|
+
- Discovers potential primary keys and relationships between columns
|
|
151
|
+
- Suggests possible normalized table structures
|
|
152
|
+
- Helps understand table organization and optimize schema design
|
|
153
|
+
|
|
154
|
+
3. **Analyze Column Distributions**
|
|
155
|
+
- Generates histograms, box plots, and other statistical visualizations
|
|
156
|
+
- Identifies the distribution pattern of each column (normal, uniform, etc.)
|
|
157
|
+
- Provides detailed statistics like min, max, mean, median, skewness
|
|
158
|
+
- Helps identify outliers and understand data patterns
|
|
159
|
+
|
|
160
|
+
4. **Analyze Foreign Keys** (multi-table selection)
|
|
161
|
+
- Select multiple tables by holding Ctrl or Shift while clicking
|
|
162
|
+
- Right-click to access "Analyze Foreign Keys Between X Tables"
|
|
163
|
+
- Automatically discovers potential foreign key relationships between tables
|
|
164
|
+
- Identifies matching columns that could serve as join conditions
|
|
165
|
+
- Helps understand cross-table relationships in your data model
|
|
166
|
+
|
|
167
|
+
### Using the Profilers
|
|
168
|
+
|
|
169
|
+
1. **Access the Profilers**
|
|
170
|
+
- Right-click on any table in the schema browser
|
|
171
|
+
- Select the desired profiling option from the context menu
|
|
172
|
+
- For foreign key analysis, select multiple tables first
|
|
173
|
+
|
|
174
|
+
2. **Interpret the Results**
|
|
175
|
+
- Each profiler provides interactive visualizations
|
|
176
|
+
- Hover over charts for detailed information
|
|
177
|
+
- Switch between different views using the tabs
|
|
178
|
+
- Sort and filter results to focus on specific columns
|
|
179
|
+
|
|
180
|
+
3. **Benefits**
|
|
181
|
+
- Quickly understand data composition without writing queries
|
|
182
|
+
- Identify data quality issues and outliers
|
|
183
|
+
- Discover relationships between columns
|
|
184
|
+
- Make informed decisions about query optimization
|
|
185
|
+
|
|
186
|
+
The table profiling tools are invaluable for exploratory data analysis, helping you gain insights before writing complex queries.
|
|
187
|
+
|
|
188
|
+
## 📊 Column Analysis
|
|
189
|
+
|
|
190
|
+
SQLShell provides powerful tools to analyze individual columns directly from your query results:
|
|
191
|
+
|
|
192
|
+
### Explain Column Feature
|
|
193
|
+
|
|
194
|
+
The "Explain Column" feature helps you understand the relationships between columns in your query results:
|
|
195
|
+
|
|
196
|
+
1. **How to Access**:
|
|
197
|
+
- Right-click on any column header in the query results table
|
|
198
|
+
- Select "Explain Column" from the context menu
|
|
199
|
+
|
|
200
|
+
2. **What It Does**:
|
|
201
|
+
- Analyzes the selected column's relationship with other columns in the result set
|
|
202
|
+
- Identifies correlations and dependencies between columns
|
|
203
|
+
- Provides visualizations to help understand the column's importance and distribution
|
|
204
|
+
|
|
205
|
+
3. **Benefits**:
|
|
206
|
+
- Quickly identify which columns are most related to your target column
|
|
207
|
+
- Discover hidden patterns and relationships in your data
|
|
208
|
+
- Make data-driven decisions without writing complex analytical queries
|
|
209
|
+
|
|
210
|
+
### Multivariate Analysis Feature
|
|
211
|
+
|
|
212
|
+
The Column Profiler now offers in-depth multivariate analysis to explore relationships between columns:
|
|
213
|
+
|
|
214
|
+
1. **How to Access**:
|
|
215
|
+
- In the Column Profiler, double-click on any feature in the importance table
|
|
216
|
+
- A detailed visualization window will appear showing the relationship between the selected feature and the target column
|
|
217
|
+
|
|
218
|
+
2. **Smart Visualizations**:
|
|
219
|
+
- Automatically selects the most appropriate visualization based on data types:
|
|
220
|
+
- **Numeric vs. Numeric**: Scatter plot with regression line
|
|
221
|
+
- **Categorical vs. Numeric**: Bar chart showing average values
|
|
222
|
+
- **Numeric vs. Categorical**: Box plot showing distribution
|
|
223
|
+
- **Categorical vs. Categorical**: Heatmap showing relationship strength
|
|
224
|
+
|
|
225
|
+
3. **Benefits**:
|
|
226
|
+
- Gain deeper insights into how features relate to your target variable
|
|
227
|
+
- Understand which features have strong predictive relationships
|
|
228
|
+
- Identify patterns and outliers in multivariate relationships
|
|
229
|
+
- Make better decisions about feature selection for analysis and modeling
|
|
230
|
+
|
|
231
|
+
This feature is particularly useful for exploratory data analysis, helping you understand your data structure and relationships on the fly.
|
|
232
|
+
|
|
233
|
+
## 📋 Requirements
|
|
234
|
+
|
|
235
|
+
- Python 3.8 or higher
|
|
236
|
+
- Dependencies (automatically installed):
|
|
237
|
+
- PyQt6 ≥ 6.4.0
|
|
238
|
+
- DuckDB ≥ 0.9.0
|
|
239
|
+
- Pandas ≥ 2.0.0
|
|
240
|
+
- NumPy ≥ 1.24.0
|
|
241
|
+
- openpyxl ≥ 3.1.0 (Excel support)
|
|
242
|
+
- pyarrow ≥ 14.0.1 (Parquet support)
|
|
243
|
+
- fastparquet ≥ 2023.10.1 (Alternative parquet engine)
|
|
244
|
+
- xlrd ≥ 2.0.1 (Support for older .xls files)
|
|
245
|
+
|
|
246
|
+
## 📄 License
|
|
247
|
+
|
|
248
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|