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/25 23:12:08 UTC
[GitHub] [airflow] blag opened a new pull request #22537: Consistent DB upgrade/downgrade arguments
blag opened a new pull request #22537:
URL: https://github.com/apache/airflow/pull/22537
<!--
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 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/
-->
This is a follow up to #22102, and be forewarned, this might be a bikeshed. If this gets contentious at all, I'll just close it and move on.
I think it's a little bit easier for users to have consistent flags/arguments for the `airflow db upgrade` and `airflow db downgrade` commands. This PR just tweaks the argument processing to expect `--to-revision` and `--to-version` instead of `--revision` and `--version`, respectively.
That change makes the arguments to those commands more consistent with the `--from-revision` and `--from-version` arguments. Doing so also avoids overloading the `--version` flag, which is usually a flag that prints out the version information of the command itself (eg: Airflow's version, which is available via `airflow version`).
An argument against this change is that the `--to-...` arguments can be understood to be implied, like this:
```bash
airflow db upgrade --from-10.15.8 # Upgrade from 10.15.8 to the current Airflow version
```
and this means that you do not necessarily need to always specify the `--to-...` arguments. By having both `--to-` and `--from-` arguments, users might think that they always need to specify both a `--to-` and `--from-` argument.
I also fixed an unrelated grammar typo, which corrects the grammar used to log the operation.
--
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] ephraimbuddy commented on a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r835736135
##########
File path: airflow/cli/commands/db_command.py
##########
@@ -49,15 +49,15 @@ def resetdb(args):
def upgradedb(args):
"""Upgrades the metadata database"""
print("DB: " + repr(settings.engine.url))
- if args.revision and args.version:
- raise SystemExit("Cannot supply both `--revision` and `--version`.")
+ if args.to_revision and args.to_version:
+ raise SystemExit("Cannot supply both `--to-revision` and `--to-version`.")
if args.from_version and args.from_revision:
raise SystemExit("Cannot supply both `--from-revision` and `--from-version`")
if (args.from_revision or args.from_version) and not args.show_sql_only:
raise SystemExit(
"Args `--from-revision` and `--from-version` may only be used with `--show-sql-only`"
Review comment:
Looks like when we use `--from-version` or `--from-revision` we must use `--show-sql-only`. Should we make it to run real migration if the flag is used and raise error only if the user's version/revision is not the same with the supplied `--from-revision` /`--from-version`
--
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] blag commented on a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
blag commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r837877935
##########
File path: airflow/cli/commands/db_command.py
##########
@@ -49,15 +49,15 @@ def resetdb(args):
def upgradedb(args):
"""Upgrades the metadata database"""
print("DB: " + repr(settings.engine.url))
- if args.revision and args.version:
- raise SystemExit("Cannot supply both `--revision` and `--version`.")
+ if args.to_revision and args.to_version:
+ raise SystemExit("Cannot supply both `--to-revision` and `--to-version`.")
if args.from_version and args.from_revision:
raise SystemExit("Cannot supply both `--from-revision` and `--from-version`")
if (args.from_revision or args.from_version) and not args.show_sql_only:
raise SystemExit(
"Args `--from-revision` and `--from-version` may only be used with `--show-sql-only`"
Review comment:
That's a good idea, but it's outside the scope of this PR.
--
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] blag commented on a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
blag commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r838009367
##########
File path: airflow/utils/db.py
##########
@@ -742,7 +742,7 @@ def check_and_run_migrations():
if len(db_heads) < 1:
db_command = initdb
command_name = "init"
- verb = "initialization"
+ verb = "initialize"
Review comment:
That's the unrelated grammar typo I mentioned in the description ("initialization" isn't a verb).
If this PR isn't merged, I'll submit a tiny fix for that separately. It just seemed a little heavy handed to open a full PR for a tiny typo fix.
--
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 a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
dstandish commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r838765604
##########
File path: airflow/utils/db.py
##########
@@ -742,7 +742,7 @@ def check_and_run_migrations():
if len(db_heads) < 1:
db_command = initdb
command_name = "init"
- verb = "initialization"
+ verb = "initialize"
Review comment:
ohhh 💡
i thought that `verb` was used for more than console output like `getattr(db, verb)()` or something
but no, that's what `command_name` is i guess. so cool really just a typo 👍
--
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 a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
dstandish commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r837979013
##########
File path: airflow/cli/commands/db_command.py
##########
@@ -49,15 +49,15 @@ def resetdb(args):
def upgradedb(args):
"""Upgrades the metadata database"""
print("DB: " + repr(settings.engine.url))
- if args.revision and args.version:
- raise SystemExit("Cannot supply both `--revision` and `--version`.")
+ if args.to_revision and args.to_version:
+ raise SystemExit("Cannot supply both `--to-revision` and `--to-version`.")
if args.from_version and args.from_revision:
raise SystemExit("Cannot supply both `--from-revision` and `--from-version`")
if (args.from_revision or args.from_version) and not args.show_sql_only:
raise SystemExit(
"Args `--from-revision` and `--from-version` may only be used with `--show-sql-only`"
Review comment:
my 2c, that would make it so that, when used without `sql-only`, the arg `--from-version` would only be allowed when it has _no effect_; in that case it seems to me it makes sense to just not accept it. is there some benefit to accepting the arg in that case?
it would make the documentation more cumbersome too.
--
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] kaxil merged pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #22537:
URL: https://github.com/apache/airflow/pull/22537
--
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] github-actions[bot] commented on pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#issuecomment-1082455414
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.
--
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] blag commented on pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
blag commented on pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#issuecomment-1084958340
This seems a lot less contentious than I was expecting it to possibly be, so I think it's ready to be merged.
--
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 a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
dstandish commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r837980837
##########
File path: airflow/utils/db.py
##########
@@ -742,7 +742,7 @@ def check_and_run_migrations():
if len(db_heads) < 1:
db_command = initdb
command_name = "init"
- verb = "initialization"
+ verb = "initialize"
Review comment:
maybe it was renamed in alembic with deprecation?
--
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 a change in pull request #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
dstandish commented on a change in pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#discussion_r837980179
##########
File path: airflow/utils/db.py
##########
@@ -742,7 +742,7 @@ def check_and_run_migrations():
if len(db_heads) < 1:
db_command = initdb
command_name = "init"
- verb = "initialization"
+ verb = "initialize"
Review comment:
why is this changed here? did something change?
--
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 #22537: Consistent DB upgrade/downgrade arguments
Posted by GitBox <gi...@apache.org>.
dstandish commented on pull request #22537:
URL: https://github.com/apache/airflow/pull/22537#issuecomment-1085052211
🎉
--
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