Yeah, this has always been one of the thing that is a low-level
annoyance/leaking abstraction to me, and if we can fix it in a
backwards compatible way I'm all for it!
-ash
On Thu, Nov 11 2021 at 08:56:27 +0100, Jarek Potiuk <[email protected]>
wrote:
As I understand and remember it, the "extra" prefix is needed because
of the way the connection edit form works with extra fields.
The "extra__google_cloud_platform__" is a unique prefix used in the
javascript to choose/validate the type of the extra parameter (custom
form values).The way how the javascript works there is that all the
types of fields from all the types of connections are retrieved from
all "registered" connections and they are all added to the form, butt
they are hidden by default. Only when the right "connection type" is
selected from the form, all the matching "extra__" fields are shown
(and hidden when another connection type is chosen) - thus providing
the dynamic form. The extra_ prefix is there to add uniqueness to the
id of the field and to match the field with the connection type.
The connections with the short names of extras simply do not have
dynamic fields in the connection form. And those that you found
supporting both, went from short to long in order to support the
dynamic fields and the short ones are there to support backwards
compatibility.
I'd be all for using the short name everywhere and converting the
connection form to support it. But getting backwards compatibility
might be a bit of a challenge - we have to make sure connections from
old providers will work in the new airflow and the other way round.
Also the old URLs with extra__ should work with the new solution as
well. I believe it is possible, but requires some WTForms + javascript
"magic" to make it works in a backwards-compatible way.
J.
On Thu, Nov 11, 2021 at 5:31 AM Daniel Standish <[email protected]
<mailto:[email protected]>> wrote:
For some connection types, UI customizations have been added so
that you have forms for the extra components.
E.g. with GCP we have extra__google_cloud_platform__project etc.
There's a PR for salesforce hook to make it so you that, when using
secrets backend you could use either the short or long name. E.g.
in the example above it could be
`extra__google_cloud_platform__project` or `project`.
GCP does not work like this; you must use long name.
I have always assumed that the convention is to do as is done in
GCP: long name only.
But I did a search and found a few others where we will take long
or short (wasb, azure data factory, snowflake). But I'm not sure if
this is just for backward compat until next major release, or if
it's meant to stay for the long haul.
So the question is, what should be the convention? Should we
accept either long or short, or stick with "there is preferably only
one way to do a given thing"?