forked from apache/airflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up
has_access
decorator by ~200ms (apache#22858)
Using the ORM to create all the Role, Permission, Action and Resource objects, only to throw them all away _on every request_ is slow. And since we are now using the API more and more in the UI it's starting to get noticeable This changes the `user.perm` property to issue a custom query that returns the tuple of action_name, permission_name we want, bypassing the ORM object inflation entirely, and since `user.roles` isn't needed in most requests we no longer eagerly load that. * Fix tests Caching issues that only crop up in tests (but not ever a problem in the request life cycle of webserver
- Loading branch information
Showing
6 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
f"DELETE {source_table} FROM { ', '.join(_from_name(tbl) for tbl in stmt.froms) }" | ||
for frm in source_query.selectable.froms: | ||
roles = relationship("Role", secondary=assoc_user_role, backref="user", lazy="selectin") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters