Skip to content

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

@liangchenm

Description

@liangchenm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions