diff --git a/jupyterhub/orm.py b/jupyterhub/orm.py index b30b8040..b8a45af3 100644 --- a/jupyterhub/orm.py +++ b/jupyterhub/orm.py @@ -528,9 +528,7 @@ class Hashed(Expiring): prefix = token[: cls.prefix_length] # since we can't filter on hashed values, filter on prefix # so we aren't comparing with all tokens - prefix_match = db.query(cls).filter( - bindparam('prefix', prefix).startswith(cls.prefix) - ) + prefix_match = db.query(cls).filter_by(prefix=prefix) prefix_match = prefix_match.filter( or_(cls.expires_at == None, cls.expires_at >= cls.now()) )