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.
Files changed (54) hide show
  1. sqlshell/__init__.py +84 -0
  2. sqlshell/__main__.py +4926 -0
  3. sqlshell/ai_autocomplete.py +392 -0
  4. sqlshell/ai_settings_dialog.py +337 -0
  5. sqlshell/context_suggester.py +768 -0
  6. sqlshell/create_test_data.py +152 -0
  7. sqlshell/data/create_test_data.py +137 -0
  8. sqlshell/db/__init__.py +6 -0
  9. sqlshell/db/database_manager.py +1318 -0
  10. sqlshell/db/export_manager.py +188 -0
  11. sqlshell/editor.py +1166 -0
  12. sqlshell/editor_integration.py +127 -0
  13. sqlshell/execution_handler.py +421 -0
  14. sqlshell/menus.py +262 -0
  15. sqlshell/notification_manager.py +370 -0
  16. sqlshell/query_tab.py +904 -0
  17. sqlshell/resources/__init__.py +1 -0
  18. sqlshell/resources/icon.png +0 -0
  19. sqlshell/resources/logo_large.png +0 -0
  20. sqlshell/resources/logo_medium.png +0 -0
  21. sqlshell/resources/logo_small.png +0 -0
  22. sqlshell/resources/splash_screen.gif +0 -0
  23. sqlshell/space_invaders.py +501 -0
  24. sqlshell/splash_screen.py +405 -0
  25. sqlshell/sqlshell/__init__.py +5 -0
  26. sqlshell/sqlshell/create_test_data.py +118 -0
  27. sqlshell/sqlshell/create_test_databases.py +96 -0
  28. sqlshell/sqlshell_demo.png +0 -0
  29. sqlshell/styles.py +257 -0
  30. sqlshell/suggester_integration.py +330 -0
  31. sqlshell/syntax_highlighter.py +124 -0
  32. sqlshell/table_list.py +996 -0
  33. sqlshell/ui/__init__.py +6 -0
  34. sqlshell/ui/bar_chart_delegate.py +49 -0
  35. sqlshell/ui/filter_header.py +469 -0
  36. sqlshell/utils/__init__.py +16 -0
  37. sqlshell/utils/profile_cn2.py +1661 -0
  38. sqlshell/utils/profile_column.py +2635 -0
  39. sqlshell/utils/profile_distributions.py +616 -0
  40. sqlshell/utils/profile_entropy.py +347 -0
  41. sqlshell/utils/profile_foreign_keys.py +779 -0
  42. sqlshell/utils/profile_keys.py +2834 -0
  43. sqlshell/utils/profile_ohe.py +934 -0
  44. sqlshell/utils/profile_ohe_advanced.py +754 -0
  45. sqlshell/utils/profile_ohe_comparison.py +237 -0
  46. sqlshell/utils/profile_prediction.py +926 -0
  47. sqlshell/utils/profile_similarity.py +876 -0
  48. sqlshell/utils/search_in_df.py +90 -0
  49. sqlshell/widgets.py +400 -0
  50. sqlshell-0.4.4.dist-info/METADATA +441 -0
  51. sqlshell-0.4.4.dist-info/RECORD +54 -0
  52. sqlshell-0.4.4.dist-info/WHEEL +5 -0
  53. sqlshell-0.4.4.dist-info/entry_points.txt +2 -0
  54. 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