-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
43 lines (32 loc) · 1008 Bytes
/
main.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
from sqp import DB, Table, Field
from sqp.tools import cacher
from pathlib import Path
import time
class Test(Table):
a = Field("int")
b = Field("image")
class Test2(Table):
cache = True
name = Field("string")
email = Field("string")
profile_picture = Field("blob")
def convertToBinaryData(filename):
# Convert digital data to binary format
with open(filename, "rb") as file:
blobData = file.read()
return blobData
if __name__ == "__main__":
db = DB("sqlite:/test.sqlite")
db.create_tables(Test, Test2)
db.create_auth()
# for _ in range(1000):
# db.Test2.insert(name="John Doe", email="[email protected]")
# start = time.time()
# for _ in range(10000):
# (db.Test2.id >= 0).select()
#
# end = time.time()
# print(f"Time taken: {(end - start):.4f} s")
# cacher.print_cache()
# db.Test2.insert(name="John Doe", email="[email protected]")
# db.Test2.insert(name="John Doe", email="[email protected]")