You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/05/25 09:08:49 UTC
[GitHub] [airflow] hussein-awala opened a new pull request, #31539: fix airflow users delete CLI command
hussein-awala opened a new pull request, #31539:
URL: https://github.com/apache/airflow/pull/31539
<!--
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/
-->
closes: #31509
Similar to what we have in the users API endpoint ([code](https://github.com/apache/airflow/blob/64b0872d92609e2df465989062e39357eeef9dab/airflow/api_connexion/endpoints/user_endpoint.py#L206-L206)), to avoid violating foreign key constraint `ab_user_role_user_id_fkey` on table `ab_user_role`.
---
**^ 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] hussein-awala merged pull request #31539: fix airflow users delete CLI command
Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala merged PR #31539:
URL: https://github.com/apache/airflow/pull/31539
--
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] pankajkoti commented on a diff in pull request #31539: fix airflow users delete CLI command
Posted by "pankajkoti (via GitHub)" <gi...@apache.org>.
pankajkoti commented on code in PR #31539:
URL: https://github.com/apache/airflow/pull/31539#discussion_r1205250380
##########
airflow/cli/commands/user_command.py:
##########
@@ -112,6 +112,8 @@ def users_delete(args):
"""Deletes user from DB."""
user = _find_user(args)
+ user.roles = [] # Clear foreign keys on this user first.
Review Comment:
```suggestion
user.roles.clear()
```
Do you think using `clear` could be better? It would use the existing reference to the object to clear the list and show our intent directly rather than creating a new empty list and assigning it. We won't need the additional comment in that case. What are your thoughts?
I don't have a strong opinion 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] hussein-awala commented on a diff in pull request #31539: fix airflow users delete CLI command
Posted by "hussein-awala (via GitHub)" <gi...@apache.org>.
hussein-awala commented on code in PR #31539:
URL: https://github.com/apache/airflow/pull/31539#discussion_r1205915203
##########
airflow/cli/commands/user_command.py:
##########
@@ -112,6 +112,8 @@ def users_delete(args):
"""Deletes user from DB."""
user = _find_user(args)
+ user.roles = [] # Clear foreign keys on this user first.
Review Comment:
I agree, it's cleaner and can do the job
--
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