krnhotwings commented on issue #15016: URL: https://github.com/apache/airflow/issues/15016#issuecomment-826259629
@marcosmarxm Sorry, but I'm still not entirely sure why `clean_bool` is necessary. In Python's eyes, JSON objects would just be raw strings that need to be parsed by the `json` lib and converted into a dictionary with Python data types, correct? It looks like `clean_bool` is being applied to the merged dicts of `connection_extra_lower` and `_connect_kwargs`. `connection_extra_lower` is just applying `.lower()` to the keys of `connection.extra_dejson`. `extra_dejson` is using Python's `json` lib to parse the `extras` string into a dictionary, which _should_ handle unquoted JSON boolean values, if I'm not mistaken: https://github.com/apache/airflow/blob/db9febdb3be97832679d2ced8028fd7f1c21cd4e/airflow/models/connection.py#L335 Looking at the documentation you linked, I noticed the quoted JSON boolean values in the very last example code block, but I would think that it should all work correctly with unquoted raw JSON booleans, which should make `clean_bool` unnecessary. For example, if you created a connection `testconn` in the UI with Extra: ```json { "connect_kwargs": { "DummySetting": true } } ``` it should yield: ```python >>> airflow.providers.odbc.hooks.odbc.OdbcHook('myconn').connect_kwargs {'DummySetting': True} ``` Am I missing something else? (Again, pardon any ignorance on my part.) -- 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]
