-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_db.py
54 lines (40 loc) · 1.32 KB
/
read_db.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
#!/usr/bin/python3
# Imported libraries
import sqlite3
# The sql connection & cursor
conn = sqlite3.connect('sql.db')
c = conn.cursor()
# Print favorite_color ========================================================
print("==> children")
c.execute('''SELECT * FROM children''')
children = c.fetchall()
for child in children:
print(child)
# Print children_items =======================================================
print("==> children_items")
c.execute('''SELECT * FROM children_items''')
children_items = c.fetchall()
for item in children_items:
print(item)
c.execute('''SELECT * FROM children LEFT JOIN children_items ON children_items.children_id = children.id where children.id = 1''')
children_array = c.fetchall()
for children in children_array:
print(children)
#print donors:
print("==> donors")
c.execute('''SELECT * FROM donor''')
donor = c.fetchall()
for item in donor:
print(item)
#Print Donar_sponsor_children
print("==> donar_sponsor_children")
c.execute('''SELECT * FROM donar_sponsor_children''')
donar_sponsor_children = c.fetchall()
for associations in donar_sponsor_children:
print(associations)
# Print users =================================================================
#print("==> Users")
#c.execute('''SELECT * FROM users''')
#users = c.fetchall()
#for user in users:
# print(user)