Adding a is_reachable() method to DbParams would allow users to easily check if they can reach their target database over the network. This can be helpful in debugging situations.
Details
The method could be used as follows:
if not my_db.is_reachable():
raise ETLHelperError("network problems")
It would not require any other parameters and can use Python's socket feature just to see if it is possible to connect to the required host and port. There is already a simple implementation of this in the testing code of etlhelper:
Summary
Adding a
is_reachable()
method toDbParams
would allow users to easily check if they can reach their target database over the network. This can be helpful in debugging situations.Details
The method could be used as follows:
It would not require any other parameters and can use Python's
socket
feature just to see if it is possible to connect to the required host and port. There is already a simple implementation of this in the testing code ofetlhelper
:https://github.com/BritishGeologicalSurvey/etlhelper/blob/a18bb66fc319c7d8fd4bc676bdf56f4807d5b92d/test/conftest.py#L119
Acceptance criteria
is_reachable()
function added to DbParams class