You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2023/08/05 08:09:39 UTC

[GitHub] [airflow] potiuk opened a new pull request, #33136: Fix edge cases of "migrate/create-default-connections"

potiuk opened a new pull request, #33136:
URL: https://github.com/apache/airflow/pull/33136

   In #32810, "airflow db migrate" command has been added and it is used by `start-airflow` command. There were a few edge cases not covered and this PR completes it.
   
   * The "database/load_default_connections" configuration does not need to be defined any more.
   
   It has no meaning when you use "airflow db migrate" or when you run the new "airflow connections create-default-connections" commands. So we can now remove it completely from configuraiton. It will still work in the "airflow db init" which is deprecated, as long as we provide an explicit fallback. Also if someone had it defined in their config or env variable, it will continue to work even if it is not defined.
   
   * We need to explain the change in a significant newsfragment.
   
   * The ``start-airflow`` command supports creating default connections with ``--load-default-connections`` flag. This was lost after the change so this PR brings it back by running the new "airflow connections create-default-connections" command if the flag is used.
   
   * The `start-airflow` breeze command can be used to start older versions of airflow - with ``--use-airflow-version" - those that do not support `airflow db migrate` command. In this case the old behaviour is used with setting the "AIRFLOW__DATABASE__LOAD_DEFAULT_CONNECTIONS" based on the flag passed and running "airflow db init" instead.
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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] potiuk commented on a diff in pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #33136:
URL: https://github.com/apache/airflow/pull/33136#discussion_r1285123056


##########
airflow/configuration.py:
##########
@@ -960,6 +960,14 @@ def get(  # type: ignore[override,misc]
         deprecated_section: str | None
         deprecated_key: str | None
 
+        option_description = self.configuration_description.get(section, {}).get(key, {})
+        if option_description.get("deprecated"):
+            deprecation_reason = option_description.get("deprecation_reason", "")

Review Comment:
   We already have "configuration_description" all over the places :)



-- 
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] potiuk commented on pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33136:
URL: https://github.com/apache/airflow/pull/33136#issuecomment-1666555481

   OK. Changed the approach. Seems to be nicer and less surprising. Options can now be individually deprecated (not replaced by others but just deprecated) - and deprecation reason is displayed nicely in both - warning message and in the documentation.
   
   <img width="1625" alt="Screenshot 2023-08-05 at 19 02 30" src="https://github.com/apache/airflow/assets/595491/c48d452e-2e39-43e4-860f-52cece528cbf">
   


-- 
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] potiuk commented on a diff in pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #33136:
URL: https://github.com/apache/airflow/pull/33136#discussion_r1285123066


##########
airflow/config_templates/config.yml:
##########
@@ -591,10 +591,17 @@ database:
       default: ~
     load_default_connections:
       description: |
-        Whether to load the default connections that ship with Airflow. It's good to
-        get started, but you probably want to set this to ``False`` in a production
-        environment
+        Whether to load the default connections that ship with Airflow when ``airflow db init`` is called.
+        It's good to get started, but you probably want to set this to ``False`` in a production environment.
       version_added: 2.3.0
+      deprecated: 2.7.0

Review Comment:
   Yep. Why not.



-- 
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] potiuk merged pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #33136:
URL: https://github.com/apache/airflow/pull/33136


-- 
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] potiuk commented on pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33136:
URL: https://github.com/apache/airflow/pull/33136#issuecomment-1666624266

   Same flaky as fixed (?) in main.


-- 
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] potiuk commented on pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33136:
URL: https://github.com/apache/airflow/pull/33136#issuecomment-1666436051

   cc: @Adaverse -> small follow up after #32810 - noticed a few edge-cases and I think we need to add release notes to explain the new behaviour.


-- 
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] jedcunningham commented on a diff in pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #33136:
URL: https://github.com/apache/airflow/pull/33136#discussion_r1285123140


##########
airflow/configuration.py:
##########
@@ -960,6 +960,14 @@ def get(  # type: ignore[override,misc]
         deprecated_section: str | None
         deprecated_key: str | None
 
+        option_description = self.configuration_description.get(section, {}).get(key, {})
+        if option_description.get("deprecated"):
+            deprecation_reason = option_description.get("deprecation_reason", "")

Review Comment:
   fair enough 👍



##########
airflow/configuration.py:
##########
@@ -960,6 +960,14 @@ def get(  # type: ignore[override,misc]
         deprecated_section: str | None
         deprecated_key: str | None
 
+        option_description = self.configuration_description.get(section, {}).get(key, {})
+        if option_description.get("deprecated"):
+            deprecation_reason = option_description.get("deprecation_reason", "")

Review Comment:
   fair enough 👍



-- 
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] jedcunningham commented on a diff in pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "jedcunningham (via GitHub)" <gi...@apache.org>.
jedcunningham commented on code in PR #33136:
URL: https://github.com/apache/airflow/pull/33136#discussion_r1285120620


##########
airflow/config_templates/config.yml:
##########
@@ -591,10 +591,17 @@ database:
       default: ~
     load_default_connections:
       description: |
-        Whether to load the default connections that ship with Airflow. It's good to
-        get started, but you probably want to set this to ``False`` in a production
-        environment
+        Whether to load the default connections that ship with Airflow when ``airflow db init`` is called.
+        It's good to get started, but you probably want to set this to ``False`` in a production environment.
       version_added: 2.3.0
+      deprecated: 2.7.0

Review Comment:
   Maybe `version_deprecated`?



##########
airflow/configuration.py:
##########
@@ -960,6 +960,14 @@ def get(  # type: ignore[override,misc]
         deprecated_section: str | None
         deprecated_key: str | None
 
+        option_description = self.configuration_description.get(section, {}).get(key, {})
+        if option_description.get("deprecated"):
+            deprecation_reason = option_description.get("deprecation_reason", "")

Review Comment:
   ```suggestion
           option_details = self.configuration_description.get(section, {}).get(key, {})
           if option_details.get("deprecated"):
               deprecation_reason = option_details.get("deprecation_reason", "")
   ```
   
   nit, take it or leave it.



-- 
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] potiuk commented on pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33136:
URL: https://github.com/apache/airflow/pull/33136#issuecomment-1666608881

   How about this?
   
   <img width="1620" alt="Screenshot 2023-08-05 at 23 14 02" src="https://github.com/apache/airflow/assets/595491/95630116-d1ae-40e9-81a6-9c6c700f3da1">
   
   (other things except description -> detail done. I might want to change it in a separate PR though.


-- 
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] potiuk commented on pull request #33136: Fix edge cases of "migrate/create-default-connections"

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #33136:
URL: https://github.com/apache/airflow/pull/33136#issuecomment-1666606127

   > The formatting is a little weird to me. Having the first line of the reason in the blue box feels unnecessary.
   
   Yeah. Sphinx is doing things on its own sometimes. I had another verison of it that looked different. Let me try it.


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