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 pathdatabase.py
More file actions
27 lines (17 loc) · 704 Bytes
/
database.py
File metadata and controls
27 lines (17 loc) · 704 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
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, declarative_base
# Create an engine to your database (SQLite for simplicity)
engine = create_engine('sqlite:///freebie_tracker.db', echo=True)
# Create a configured "Session" class
Session = sessionmaker(bind=engine)
# Create a session instance
session = Session()
# Base class for declarative models
Base = declarative_base()
# from sqlalchemy import create_engine
# from sqlalchemy.orm import sessionmaker
# from models import Base # Make sure Base is defined in models.py
# DATABASE_URL = "sqlite:///freebies.db"
# engine = create_engine(DATABASE_URL)
# Session = sessionmaker(bind=engine)
# session = Session()