-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathquery.py
More file actions
32 lines (26 loc) · 874 Bytes
/
query.py
File metadata and controls
32 lines (26 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from builtins import super
from sqlalchemy.orm.query import Query
from sqlalchemy.orm.session import Session, sessionmaker
from .util.decorators import xray_on_call, decorate_all_functions
@decorate_all_functions(xray_on_call)
class XRaySession(Session):
pass
@decorate_all_functions(xray_on_call)
class XRayQuery(Query):
pass
@decorate_all_functions(xray_on_call)
class XRaySessionMaker(sessionmaker):
def __init__(self, bind=None, class_=XRaySession, autoflush=True,
autocommit=False,
expire_on_commit=True,
info=None, **kw):
kw['query_cls'] = XRayQuery
super().__init__(
bind=bind,
class_=class_,
autoflush=autoflush,
autocommit=autocommit,
expire_on_commit=expire_on_commit,
info=info,
**kw
)