sqlshell 0.4.4__py3-none-any.whl
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.
- sqlshell/__init__.py +84 -0
- sqlshell/__main__.py +4926 -0
- sqlshell/ai_autocomplete.py +392 -0
- sqlshell/ai_settings_dialog.py +337 -0
- sqlshell/context_suggester.py +768 -0
- sqlshell/create_test_data.py +152 -0
- sqlshell/data/create_test_data.py +137 -0
- sqlshell/db/__init__.py +6 -0
- sqlshell/db/database_manager.py +1318 -0
- sqlshell/db/export_manager.py +188 -0
- sqlshell/editor.py +1166 -0
- sqlshell/editor_integration.py +127 -0
- sqlshell/execution_handler.py +421 -0
- sqlshell/menus.py +262 -0
- sqlshell/notification_manager.py +370 -0
- sqlshell/query_tab.py +904 -0
- sqlshell/resources/__init__.py +1 -0
- sqlshell/resources/icon.png +0 -0
- sqlshell/resources/logo_large.png +0 -0
- sqlshell/resources/logo_medium.png +0 -0
- sqlshell/resources/logo_small.png +0 -0
- sqlshell/resources/splash_screen.gif +0 -0
- sqlshell/space_invaders.py +501 -0
- sqlshell/splash_screen.py +405 -0
- sqlshell/sqlshell/__init__.py +5 -0
- sqlshell/sqlshell/create_test_data.py +118 -0
- sqlshell/sqlshell/create_test_databases.py +96 -0
- sqlshell/sqlshell_demo.png +0 -0
- sqlshell/styles.py +257 -0
- sqlshell/suggester_integration.py +330 -0
- sqlshell/syntax_highlighter.py +124 -0
- sqlshell/table_list.py +996 -0
- sqlshell/ui/__init__.py +6 -0
- sqlshell/ui/bar_chart_delegate.py +49 -0
- sqlshell/ui/filter_header.py +469 -0
- sqlshell/utils/__init__.py +16 -0
- sqlshell/utils/profile_cn2.py +1661 -0
- sqlshell/utils/profile_column.py +2635 -0
- sqlshell/utils/profile_distributions.py +616 -0
- sqlshell/utils/profile_entropy.py +347 -0
- sqlshell/utils/profile_foreign_keys.py +779 -0
- sqlshell/utils/profile_keys.py +2834 -0
- sqlshell/utils/profile_ohe.py +934 -0
- sqlshell/utils/profile_ohe_advanced.py +754 -0
- sqlshell/utils/profile_ohe_comparison.py +237 -0
- sqlshell/utils/profile_prediction.py +926 -0
- sqlshell/utils/profile_similarity.py +876 -0
- sqlshell/utils/search_in_df.py +90 -0
- sqlshell/widgets.py +400 -0
- sqlshell-0.4.4.dist-info/METADATA +441 -0
- sqlshell-0.4.4.dist-info/RECORD +54 -0
- sqlshell-0.4.4.dist-info/WHEEL +5 -0
- sqlshell-0.4.4.dist-info/entry_points.txt +2 -0
- sqlshell-0.4.4.dist-info/top_level.txt +1 -0
sqlshell/__init__.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SQLShell - A powerful SQL shell with GUI interface for data analysis
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
def _get_version() -> str:
|
|
8
|
+
"""Get version from pyproject.toml (single source of truth)."""
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import re
|
|
11
|
+
|
|
12
|
+
# For PyInstaller frozen executables, check bundled pyproject.toml
|
|
13
|
+
if getattr(sys, 'frozen', False):
|
|
14
|
+
try:
|
|
15
|
+
# PyInstaller stores data files in sys._MEIPASS
|
|
16
|
+
bundle_dir = Path(sys._MEIPASS)
|
|
17
|
+
pyproject = bundle_dir / "pyproject.toml"
|
|
18
|
+
if pyproject.exists():
|
|
19
|
+
content = pyproject.read_text()
|
|
20
|
+
match = re.search(r'^version\s*=\s*["\']([^"\']+)["\']', content, re.MULTILINE)
|
|
21
|
+
if match:
|
|
22
|
+
return match.group(1)
|
|
23
|
+
except Exception:
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
# Development mode: read from pyproject.toml relative to package
|
|
27
|
+
try:
|
|
28
|
+
pyproject = Path(__file__).parent.parent / "pyproject.toml"
|
|
29
|
+
if pyproject.exists():
|
|
30
|
+
content = pyproject.read_text()
|
|
31
|
+
match = re.search(r'^version\s*=\s*["\']([^"\']+)["\']', content, re.MULTILINE)
|
|
32
|
+
if match:
|
|
33
|
+
return match.group(1)
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
# Fallback: read from installed package metadata (pip install)
|
|
38
|
+
try:
|
|
39
|
+
from importlib.metadata import version
|
|
40
|
+
return version("sqlshell")
|
|
41
|
+
except Exception:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
return "0.0.0" # Last resort fallback
|
|
45
|
+
|
|
46
|
+
__version__ = _get_version()
|
|
47
|
+
__author__ = "SQLShell Team"
|
|
48
|
+
|
|
49
|
+
from sqlshell.__main__ import main, SQLShell
|
|
50
|
+
from PyQt6.QtWidgets import QApplication
|
|
51
|
+
|
|
52
|
+
def start(database_path=None):
|
|
53
|
+
"""Start the SQLShell application.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
database_path (str, optional): Path to a database file to open. If provided,
|
|
57
|
+
SQLShell will automatically open this database on startup.
|
|
58
|
+
"""
|
|
59
|
+
app = QApplication(sys.argv)
|
|
60
|
+
window = SQLShell()
|
|
61
|
+
|
|
62
|
+
if database_path:
|
|
63
|
+
try:
|
|
64
|
+
# Open the database
|
|
65
|
+
window.db_manager.open_database(database_path, load_all_tables=True)
|
|
66
|
+
|
|
67
|
+
# Update UI with tables from the database
|
|
68
|
+
for table_name, source in window.db_manager.loaded_tables.items():
|
|
69
|
+
if source.startswith('database:'):
|
|
70
|
+
window.tables_list.add_table_item(table_name, "database")
|
|
71
|
+
|
|
72
|
+
# Update the completer with table and column names
|
|
73
|
+
window.update_completer()
|
|
74
|
+
|
|
75
|
+
# Update status bar
|
|
76
|
+
window.statusBar().showMessage(f"Connected to database: {database_path}")
|
|
77
|
+
window.db_info_label.setText(window.db_manager.get_connection_info())
|
|
78
|
+
except Exception as e:
|
|
79
|
+
print(f"Error opening database: {e}")
|
|
80
|
+
|
|
81
|
+
window.show()
|
|
82
|
+
return app.exec()
|
|
83
|
+
|
|
84
|
+
# SQLShell package initialization
|