Rename db upgrade to db migrate and add connections create-default-connections#32810
Conversation
db upgrade with db sync and adds create-default-connectionsdb upgrade with db sync and add create-default-connections
db upgrade with db sync and add create-default-connectionsdb upgrade to db sync and add create-default-connections
|
Two things:
|
Yes we can hide arguments using I have added a constant that holds the subcommand that needs to be hidden. |
|
Was there a discussion to use |
Have created an announcement in the dev channel with context asking what everybody thinks - https://lists.apache.org/thread/3njd9l8fpcshnkk61t74orntp13w4vjo The above change is not yet final in any way. Depends on collective agreement. Do I also need to cc some other channels? |
|
No this is good, I just wondered if it’s based on a decision made somewhere I’m not aware of. |
| func=lazy_load_command("airflow.cli.commands.db_command.drop_archived"), | ||
| args=(ARG_DB_TABLES, ARG_YES), | ||
| ), | ||
| ActionCommand( |
There was a problem hiding this comment.
Should we already move it to the connections command in this PR?
There was a problem hiding this comment.
I hope it is fine now to replace every instance of db init and db upgrade with db migrate in the doc?
There was a problem hiding this comment.
There are few places where initdb from airflow.utils.db is being called that creates default connection ex -
Lines 1669 to 1670 in f91c003
Lines 845 to 848 in f91c003
Shall we replace these now with upgradedb or maybe in later commits when we would have added the desired functionality to create_default_connections?
There was a problem hiding this comment.
I hope it is fine now to replace every instance of db init and db upgrade with db migrate in the doc?
yes
Shall we replace these now with upgradedb or maybe in later commits when we would have added the desired functionality to create_default_connections?
should be migrate in both cases I think. That was the intention in both cases, I think
There was a problem hiding this comment.
should be
migratein both cases I think.
Currently, we have just renamed the command and the function names in db_commands.py. I think its best to take the renaming of airflow.utils.db.upgradedb to be taken in another PR since it is used at lots of other places and quite some refactoring is required for above change.
db upgrade to db sync and add create-default-connectionsdb upgrade to db migrate and add connections create-default-connections
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
…eployment.rst Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
Co-authored-by: Jed Cunningham <[email protected]>
In apache#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. * We can move the "database/load_default_connections" configuration to a new "deprecated" section. This is the first time we remove the option completely as it lost its meaning, but we likely still want to explain that the option was there and what it does when deprecated "db init" command is used. 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.
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. * We can move the "database/load_default_connections" configuration to a new "deprecated" section. This is the first time we remove the option completely as it lost its meaning, but we likely still want to explain that the option was there and what it does when deprecated "db init" command is used. 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.
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. * We can move the "database/load_default_connections" configuration to a new "deprecated" section. This is the first time we remove the option completely as it lost its meaning, but we likely still want to explain that the option was there and what it does when deprecated "db init" command is used. 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. (cherry picked from commit b672ba4)
Addresses: #32420
Related: #32048
db upgradewithdb syncdb migrateand deprecated the formerdb initand addedconnections create-default-connectionsto create the default connectionThis PR is part of PRs where we target to move the process of configuring default connections out of core Airflow to there respective providers.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.