데모페이지를 완성했다
Today I Learned 날짜 2023년 12월 20일 수요일 내용 데모 관련 Task 끝 어제 발견했던대로, DB에 commit이 일어나면 object가 refresh되었다. Loading Relationships In the last step, we called [Session.commit()](https://docs.sqlalchemy.org/en/14/orm/session_api.html#sqlalchemy.orm.Session.commit) which emitted a COMMIT for the transaction, and then per [Session.commit.expire_on_commit](https://docs.sqlalchemy.org/en/14/orm/session_api.html#sqlalchemy.orm.Session.commit.params.expire_on_commit) expired all objects so that they refresh for the next transaction. SQLAlchemy docs에서 찾은 내용이다. db에 commit하면 현재 session의 object들이 expired되고, object를 새로 로드해야 한다. 로그인할 때, object로 계정 정보로 DB에서 관련된 shop들을 가져오는데, 데모 로그인떄는 데모 스토어로 사용할 shop만 가져오도록 로직을 작성했다. 이 object가 동기화되면서 내가 선택한 shop이 무용지물 되버린건데.. 내가 몰랐던 SQLAlchemy의 기능인 것 같다. ...