Closed soltanianalytics closed 3 years ago
Interesting. The 'version' error has already been fixed in master for the upcoming 2.0.1 (merged 2 days ago).
I do not think it was causing the problem but maybe installing master version and trying out might be something you could try before I dig deeper @soltanianalytics ?
Can you try one more thing ? I think I know what could be the problem. The problem is lilkely in the javascript which might not be ready for having two connections where name of one connection (jdbc) is substring of the other (jdbcx). Could you please change the name of the jdbcx
to jdxbc
everywhere ? That could help us to narrow-down the problem and then we can likely find a fix for that.
(Note - the javascript was there in 1.10 but we simply did not have such 'overlapping' connection names :)
The naming change seems to fix the duplicate fields issue:
However, this does not fix that the extra is an empty string for the "x" version:
The extra is also not encrypted in the metadata db, if that information helps.
Can you point me at where the extra is saved to the metadata database? It seems to me that the issue may be arising there. Saving non-extra fields (login, password, ...) works just fine. It's only the extra fields that don't work because for some reason, it saves an empty string instead of the full extra. It seems that when it is working correctly, the extra saved a dict with values for all custom widgets, no matter what the connection is - and this fails for some reason for my custom connection types, except for the copied jdbc one, strangely enough.
OK. Sorry I have not seen your answer - good that we know about the duplication. That should be easy fix :).
And I think I know where the problem is. There is one more place I missed in views.py
:
def process_form(self, form, is_created):
"""Process form data."""
formdata = form.data
if formdata['conn_type'] in ['jdbc', 'google_cloud_platform', 'grpc', 'yandexcloud', 'kubernetes']:
extra = {key: formdata[key] for key in self.extra_fields if key in formdata}
form.extra.data = json.dumps(extra)
Both are to be fixed in 2.0.1 then !
Thanks for being so thorough!. You can test it by locally modifying the airflow/www/views.py
and adding the connection_type there !
BTW. I realized that the original implementation is somewhat wrong as it stores all the extras from all the connection in extra of any connection (even if it is empty). Not nice :).
Hey @soltanianalytics - I implemented fixes for all the problems in #13640. I tested it for built-in providers and I have a reason to believe they should also work for custom ones.
Would it be possible that you apply those changes in your installation and see if they work es expected ?
I'd greatly appreciate it.
Apache Airflow version: 2.0.0
Environment: Docker image
apache/airflow:2.0.0-python3.8
on Win10 with WSLWhat happened:
I built a custom provider with a number of custom connections.
This works:
get_ui_field_behaviour
get_ui_field_behaviour
get_connection_form_widgets
(well, mostly)What does not work:
I used the JDBC example to string myself along by copying it and pasting it as a hook into my custom provider package. (I did not install the JDBC provider package, unless it is installed in the image I use - but if I don't add it in my own provider package, I don't have the connection type in the UI, so I assume it is not). Curiously, The JDBC hook works just fine. I then created the following file:
What you expected to happen:
After doing the above, I expected
What actually happenes:
ewah
has a number of other custom hooks, and the issue above occurs for all of them)Screenshot 1:
Screenshot 2:
Screenshot 3:
Screenshot 4:
Screenshot 5:
Screenshot 6 - airflow providers behaviours:
Screenshot 7 - airflow providers get: (Note: This error occurs with pre-installed providers as well)
Screenshot 8 - airflow providers hooks:
Screenshot 9 - aorflow providers list:
Screenshot 10 - airflow providers widgets:
How to reproduce it:
hook-class-names
list in the provider info