简体   繁体   English

如何删除Airflow中的所有用户?

[英]How to delete all users in Airflow?

I am setting up web authentication for Airflow web server.我正在为 Airflow Web 服务器设置 Web 身份验证。 I added a few users following the guidance of the official guide.我按照官方指南的指导添加了一些用户。 Now I want to delete all users that have been added, what should I do?现在我想删除所有已添加的用户,我该怎么办?

I have tried to我试过

session = settings.Session()
session.delete(user)

, but it does not work. ,但它不起作用。 Even if it works and it will only delete one user at a time.即使它有效并且一次只会删除一个用户。

Maybe I should regenerate the SQLAlchemy user table?也许我应该重新生成 SQLAlchemy 用户表?

Make sure you are calling session.commit() afterwards to commit the transaction.确保之后调用session.commit()来提交事务。 If you want to delete all users at once, try Session.query(User).delete() instead.如果您想一次删除所有用户,请尝试使用Session.query(User).delete()代替。 Also note that you can delete through the Airflow UI under Admin > Users .另请注意,您可以通过Admin > Users下的 Airflow UI 进行删除。

Also you can do it in CLI:您也可以在 CLI 中执行此操作:

airflow users delete -u aramis

just copy this 100 times and change the username with all users you have, then paste it into CLI.只需复制 100 次并使用您拥有的所有用户更改username ,然后将其粘贴到 CLI 中。

-u is username -u是用户名

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM