BritishGeologicalSurvey / etlhelper

ETL Helper is a Python ETL library to simplify data transfer into and out of databases.
https://britishgeologicalsurvey.github.io/etlhelper/
GNU Lesser General Public License v3.0
105 stars 25 forks source link

Add database network check to DbParams #32

Closed volcan01010 closed 4 years ago

volcan01010 commented 4 years ago

Summary

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:

https://github.com/BritishGeologicalSurvey/etlhelper/blob/a18bb66fc319c7d8fd4bc676bdf56f4807d5b92d/test/conftest.py#L119

Acceptance criteria

volcan01010 commented 4 years ago

@ximenesuk - if we add this, it will help with future debugging.

volcan01010 commented 4 years ago

Closed by #33