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
26 lines (21 loc) · 754 Bytes
/
debug.py
File metadata and controls
26 lines (21 loc) · 754 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
#!/usr/bin/env python3
"""
debug.py - Tests code in Python console
Run: pipenv run python debug.py
Then you can type commands in the interactive shell to test things.
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Company, Dev, Freebie
if __name__ == '__main__':
# Connect to database
engine = create_engine('sqlite:///freebies.db')
Session = sessionmaker(bind=engine)
session = Session()
print("\n✓ Database connected!")
print("You can now test your code. Try:")
print(" john = session.query(Dev).filter_by(name='John').first()")
print(" print(john.freebies)")
print(" print(john.companies)")
print("\n")
import ipdb; ipdb.set_trace()