Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- none

# v2026.4.1-beta
- sqlmath-python - Add __repr__ and __bool__ methods to SqlmathDb for better debugging experience.
- sqlmath - Removue under-used custom-files sqlmath_custom.c, sqlmath_custom.mjs.
- github-ci - Pin various github-runner-os to stable/lts version.
- sqlmath-demo - Change historical charts from 5-years to 3-years.
Expand Down
9 changes: 9 additions & 0 deletions sqlmath/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ class SqlmathDb:
filename = ""
ptr = 0

def __repr__(self):
"""Return string representation for debugging."""
state = "closed" if self.closed else "open"
return f"SqlmathDb({self.filename!r}, {state})"

def __bool__(self):
"""Return True if database is open."""
return not self.closed


class SqlmathError(Exception):
"""Sqlmath error."""
Expand Down