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
23 lines (17 loc) · 658 Bytes
/
debug.py
File metadata and controls
23 lines (17 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from models import Base, Company, Dev, Freebie
if __name__ == '__main__':
# Set up database connection
engine = create_engine('sqlite:///freebies.db')
# Create a session class and instance
Session = sessionmaker(bind=engine)
session = Session()
# Create tables if they don't exist
Base.metadata.create_all(engine)
# Make session available in debugger's global namespace
import __main__
__main__.session = session
# Start debugger with all variables available
import ipdb; ipdb.set_trace()