Yes sure,

The question was the following:
"I was looking at the code of the connections, and I realized you can't
easily add a connection type without modifying the airflow code source. I
wanted to create a mongodb connection type, but I think the best approche
would be to refactor connections first. Thoughts anyone?"

The answer of Bolke de Bruin was: "making it more generic would be
appreciated"

So basically the way the code is set up actually every types of connection
existing is defined though a list in the Connection class. It implements
exactly the same code for parsing uri to get connections info and doesn't
allow for a simple way to get back the uri from the connection infos.

I need to add a mongodb connection and a way to get it back as a uri, so i
could use an other type of connection and play around with that or juste
add one more hard coded connection type, but I though this might be
something that comes back regularly and having a simple way to plug in new
types of connection would make it easier for anyone to contribute a new
connection type.

Hope this clarifies my proposal.

Le lun. 9 janv. 2017 à 12:46, Alex Van Boxel <[email protected]> a écrit :

> Hey Gael,
>
> could you please recap the question here and provide some context. Not
> everyone on the mailinglist is actively following Gitter, including me.
> With some context it would be easier to give feedback. Thanks.
>
> On Mon, Jan 9, 2017 at 11:15 AM Gael Magnan <[email protected]> wrote:
>
> > 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
> >
> --
>   _/
> _/ Alex Van Boxel
>

Reply via email to