Hi,

following my question on gitter the other day and the response from Bolke
de Bruin, I've started working on refactoring the connections in airflow.

Before submitting a PR I wanted to share my proposal with you and get
feedbacks.

The idea is quite simple, I've divided the Connection class in two,
Connection and ConnectionType, connection has the same interface it had
before plus a few methods, but the class keeps a reference to a dictionary
of registered ConnectionType. It delegates the work of parsing from URI,
formatting to URI (added) and getting the hook to the ConnectionType
associated with the conn_type.

I've thought of two ways of registering new ConnectionTypes, the first is
making the BaseConnectionType use a metaclass that registered any new
ConnectionType with Connection when the class is declared, it would require
the less work to extend the connection module, as just importing the file
with the connection would do the trick.
The second one is juste to have a function/classmethod that you call
manually to register your connection. It would be simpler to understand but
requires more work every time you create a new ConnectionType.

Hope this proposal is clear enough, and I'm waiting for feebacks and
possible improvements.

Regards
Gael Magnan de Bornier

Reply via email to