Skip to content

Commit

Permalink
commented out session in __init__ of db_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSnewby committed Oct 25, 2024
1 parent 6601dae commit de12ad0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions models/engine/db_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def __init__(self):
)
if os.getenv('HBNB_ENV') == 'test':
Base.metadata.drop_all(self.__engine)
self.__session = sessionmaker(scoped_session,
bind=self.__engine,
expire_on_commit=False)()
# session_factory = sessionmaker(bind=self.__engine,
# expire_on_commit=False)()
# self.__session = scoped_session(session_factory)
# self.__engine = create_engine(
# 'mysql+mysqldb://user:pwd@localhost/db_name'
# )
Expand Down Expand Up @@ -78,5 +78,6 @@ def save(self):
def reload(self):
"""Reload data from the database."""
Base.metadata.create_all(self.__engine)
session_factory = sessionmaker(bind=self.__engine)
session_factory = sessionmaker(bind=self.__engine,
expire_on_commit=False)
self.__session = scoped_session(session_factory)

0 comments on commit de12ad0

Please sign in to comment.