-
Notifications
You must be signed in to change notification settings - Fork 8
/
speed_test.py
57 lines (45 loc) · 1.86 KB
/
speed_test.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from scim2_filter_parser.query import SQLiteQuery
def short():
filter = 'userName eq "test"'
attr_map = {
("name", "familyname", None): "name.familyname",
("emails", None, None): "emails",
("emails", "type", None): "emails.type",
("emails", "value", None): "emails.value",
("username", None, None): "username",
("title", None, None): "title",
("usertype", None, None): "usertype",
("schemas", None, None): "schemas",
("username", None, "urn:ietf:params:scim:schemas:core:2.0:user"): "username",
("meta", "lastmodified", None): "meta.lastmodified",
("ims", "type", None): "ims.type",
("ims", "value", None): "ims.value",
}
joins = (
"LEFT JOIN emails ON emails.user_id = users.id",
"LEFT JOIN schemas ON schemas.user_id = users.id",
)
q = SQLiteQuery(filter, "users", attr_map, joins)
q.sql
def long():
filter = 'emails[type eq "work" and value co "@example.com"] or ims[type eq "xmpp" and value co "@foo.com"]'
attr_map = {
("name", "familyname", None): "name.familyname",
("emails", None, None): "emails",
("emails", "type", None): "emails.type",
("emails", "value", None): "emails.value",
("username", None, None): "username",
("title", None, None): "title",
("usertype", None, None): "usertype",
("schemas", None, None): "schemas",
("username", None, "urn:ietf:params:scim:schemas:core:2.0:user"): "username",
("meta", "lastmodified", None): "meta.lastmodified",
("ims", "type", None): "ims.type",
("ims", "value", None): "ims.value",
}
joins = (
"LEFT JOIN emails ON emails.user_id = users.id",
"LEFT JOIN schemas ON schemas.user_id = users.id",
)
q = SQLiteQuery(filter, "users", attr_map, joins)
q.sql