You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/03/29 22:01:52 UTC

[GitHub] [airflow] dstandish opened a new pull request #22607: Enable use of custom conn extra fields without prefix

dstandish opened a new pull request #22607:
URL: https://github.com/apache/airflow/pull/22607


   Historically when adding custom extra fields we had to store them in the `extra` json field as `extra__conn_type__field_name`.
   
   This was somewhat cumbersome.  And it meant that when adding them as UI form fields, you had to make a change to the structure of the `extra` schema.
   
   With this PR, we do away with the requirement of this prefix.  In effect, we separate the field "key" -- how it is identified internally in the model and form -- with "name", how it is identified in the `extra` json field.
   
   This leaves us with a backward compatible change, so that we can update hook classes (or class families) one at a time.
   
   When the hook's field identifiers are updated to remove the prefix, old `extra` field data will still be prefilled when editing a conn in the UI.  
   
   One wrinkle was, when saving a connection that was created with the old schema, we have a choice whether to _add_ the new key (e.g. `my_param`) alongside the old key (`extra__conn_type__my_param`), or whether to replace it (delete `extra__conn_type__my_param`).  I elected to go the non-destructive route -- keeping the old value there.  Seems the lesser of two evils.
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dstandish commented on pull request #22607: Enable use of custom conn extra fields without prefix

Posted by GitBox <gi...@apache.org>.
dstandish commented on pull request #22607:
URL: https://github.com/apache/airflow/pull/22607#issuecomment-1082415162


   OK third time's a charm... maybe...
   
   This should be backward compatible and without having to set any special "versioning" attrs on any hooks.  We don't have to infer whether the hook has been updated  --- we can know by looking at how the "widget" fields are defined.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] dstandish removed a comment on pull request #22607: Enable use of custom conn extra fields without prefix

Posted by GitBox <gi...@apache.org>.
dstandish removed a comment on pull request #22607:
URL: https://github.com/apache/airflow/pull/22607#issuecomment-1082415162


   OK third time's a charm... maybe...
   
   This should be backward compatible and without having to set any special "versioning" attrs on any hooks.  We don't have to infer whether the hook has been updated  --- we can know by looking at how the "widget" fields are defined.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org