Skip to content

Commit

Permalink
Merge pull request #20 from TheSnewby/snewby
Browse files Browse the repository at this point in the history
db_storage updates
  • Loading branch information
TheSnewby authored Oct 25, 2024
2 parents cd26aa5 + de12ad0 commit 0ef2bbb
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 0ef2bbb

Please sign in to comment.