soltanianalytics edited a comment on pull request #13640:
URL: https://github.com/apache/airflow/pull/13640#issuecomment-759098491


   Yeah I re-add a connection every time I test it - I used various variants 
for the connection name. However, in the hook code it's 100% consistent: 
   
   ```Python
   class JdXbcHook(DbApiHook):
       """
       General hook for jdbc db access.
       JDBC URL, username and password will be taken from the predefined 
connection.
       Note that the whole JDBC URL must be specified in the "host" field in 
the DB.
       Raises an airflow error if the given connection id doesn't exist.
       """
   
       conn_name_attr = 'jdxbc_conn_id'
       default_conn_name = 'jdxbc_default'
       conn_type = 'jdxbc'
       hook_name = 'JDxBC Connection'
       supports_autocommit = True
   
       @staticmethod
       def get_connection_form_widgets() -> Dict[str, Any]:
           """Returns connection widgets to add to connection form"""
           from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
           from flask_babel import lazy_gettext
           from wtforms import StringField
   
           return {
               "extra__jdxbc__drv_path": StringField(lazy_gettext('Driver 
Path'), widget=BS3TextFieldWidget()),
               "extra__jdxbc__drv_clsname": StringField(
                   lazy_gettext('Driver Class'), widget=BS3TextFieldWidget()
               ),
           }
   
       @staticmethod
       def get_ui_field_behaviour() -> Dict:
           """Returns custom field behaviour"""
           return {
               "hidden_fields": ['port', 'schema', 'extra'],
               "relabeling": {'host': 'Connection URL'},
           }
   ```
   
   Plus, it does show the widget correctly, it just never saves data


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to