forked from learn-co-curriculum/python-p3-freebie-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.py
More file actions
38 lines (23 loc) · 874 Bytes
/
debug.py
File metadata and controls
38 lines (23 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
33
34
35
36
37
38
#!/usr/bin/env python3
from sqlalchemy import create_engine
from models import Company, Dev, Freebie
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
if __name__ == '__main__':
engine = create_engine('sqlite:///freebies.db')
Session = sessionmaker(bind=engine)
session = Session()
import ipdb
dev1 = session.query(Dev).filter(Dev.name == "Brandy Anderson").first()
dev1
# Dev(id=5, name=Brandy Anderson)
freebie = session.query(Freebie).first()
freebie
# Freebie(id=1, item_name=what, value=80, company_id=1, dev_id=5)
devs = session.query(Dev).first()
devs
# Dev(id=1, name=Kathleen Farmer)
dev1.give_away(devs, freebie)
# freebie doesnot belong to the dev
# Freebie(id=1, item_name=what, value=80, company_id=1, dev_id=5)
ipdb.set_trace()