Skip to content

Instantly share code, notes, and snippets.

View 2jun0's full-sized avatar
🐽
나는 언제나 강한 자의 편이다. - 부리부리몬

2jun0 2jun0

🐽
나는 언제나 강한 자의 편이다. - 부리부리몬
  • Korea
View GitHub Profile
@uris77
uris77 / repo_pattern.py
Last active May 8, 2024 14:20
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.