mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-10 11:33:01 +00:00
use relationships everywhere
in order to use sqlalchemy's expire_on_commit=False optimization, we need to make sure that objects are kept up to date. This means we cannot rely on ForeignKey ondelete/onupdate behavior, we must use sqlalchemy's local relationship cascades The main key here is that we must use relationships to set foreign-key relations, e.g. APIToken.user = user instead of APIToken.user_id = user.id. It also means that we cannot use passive_deletes, which allows sqlalchemy to defer to the database's more efficient ON DELETE behavior. This makes deletions more expensive in particular, but should improve db performance overall.
This commit is contained in:
@@ -280,7 +280,7 @@ def test_get_self(app):
|
||||
db.commit()
|
||||
oauth_token = orm.OAuthAccessToken(
|
||||
user=u.orm_user,
|
||||
client_id=oauth_client.identifier,
|
||||
client=oauth_client,
|
||||
token=token,
|
||||
grant_type=orm.GrantType.authorization_code,
|
||||
)
|
||||
|
Reference in New Issue
Block a user