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
21 lines (16 loc) · 674 Bytes
/
debug.py
File metadata and controls
21 lines (16 loc) · 674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Dev, Freebie, Company
# Setup database session
engine = create_engine('sqlite:///freebies.db')
Session = sessionmaker(bind=engine)
session = Session()
# Fetch a dev, freebie, and company from the database
dev1 = session.query(Dev).filter_by(name="Alice").first()
dev2 = session.query(Dev).filter_by(name="Bob").first()
freebie = session.query(Freebie).filter_by(item_name="T-Shirt").first()
company = session.query(Company).filter_by(name="Tech Corp").first()
# Set a breakpoint
import ipdb; ipdb.set_trace()
# Now you can test methods interactively