Skip to content

Instantly share code, notes, and snippets.

View nandoflorestan's full-sized avatar

Nando Florestan nandoflorestan

View GitHub Profile
@nandoflorestan
nandoflorestan / repo_pattern.py
Created May 28, 2016 11:55 — forked from uris77/repo_pattern.py
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.