-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (26 loc) · 877 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
from JSQL import JSQL
db = JSQL("test.json")
db.create_table(
"users",
{
'id': "int",
"username": "str",
"password": "str",
"email": "str"
},
primary_key="id",
check_if_already_exists=True
)
db.commit()
db.begin_transaction()
#db.add_column("users", "email", "str")
db.insert("users", { "id": 1, "username": "gio123", "password": "Dioporco", "email": "[email protected]"})
db.insert("users", { "id": 2, "username": "mike123", "password": "Dioporco", "email": "[email protected]"})
db.insert("users", { "id": 3, "username": "lollo123", "password": "WGesu", "email": "[email protected]"})
users = db.select("users", sort_by="id", ascending=False, limit=1, offset=0)
print(users)
db.update("users", { "password": "Cristodio"}, {"email": "[email protected]"})
import time
time.sleep(3)
db.delete("users", { "id": 3 })
db.commit()