◐ Shell
clean mode source ↗

Allow SQL-based connection validation when ping() is not available

In DBUtils, connection liveness is typically validated using a ping() call when the underlying DB-API driver provides this capability.

However, ping() is not part of the Python DB-API specification, and many widely used drivers do not implement it (e.g. PostgreSQL, Oracle, ClickHouse, and others). As a result, DBUtils currently lacks a generic, driver-independent mechanism for validating whether a pooled connection is still usable.

Proposed Enhancement

Introduce an optional SQL-based validation mechanism that can be used when ping() is unavailable.
The validation would be performed by executing a lightweight, user-configurable SQL statement (for example, SELECT 1), similar to the validationQuery concept used in Java connection pools.

This approach would provide a consistent and portable way to validate connections across different databases and drivers, while remaining fully backward compatible.