7
votes
Accepted
SQLAlchemy and DDD: It's own pattern?
This is a common issue, and the cause is usually related to a shallow understanding of DDD. The purpose of DDD is to model the functional requirements of your system such that the result is a useful ...
5
votes
Accepted
When using an ORM when should I sacrifice performance for convenience?
The way you make this decision is by optimizing when you need to.
There are many scenarios (e.g. a single-record data-entry form) where pulling all of the fields is perfectly acceptable, since you're ...
4
votes
Accepted
Should integration tests of a repository pattern use low-level ORM calls
These tests sounds like data mappings tests. I do this frequently, too, with NHiberate (an ORM for .NET). What you describe are perfectly valid tests. Beware that ORMs may have multiple layers of ...
4
votes
Accepted
Maintaining parallel libraries: Binary files access + Metadata Database ORM design
Take a step back.
If there is something in common between the two API's then they are discussing the same thing.
You can extract that sameness into a library which is expanded on by the ...
4
votes
Separate business logic from ORM models in SQLAlchemy
If you really want to decouple your persistence layer from your domain logic, you could use plain old python objects as domain objects and the "models" only for persistence. You could ...
3
votes
How to Design a Database for Both Flexibility and Data Isolation?
This is a tool problem.
Automating schema changes will be more beneficial here. Depending on laws in whatever country your application is used, data isolation may practically be mandatory.
Instead, ...
2
votes
Accepted
How to organize ORM models and business logic
When trying to solve a problem like this, it is important to know the constraints that your current design has. SQLAlchemy seems to be an implementation of the Active Record Pattern, which combines ...
2
votes
Accepted
SQLAlchemy (ORM) details in service layer in Clean Architecture?
I'm not sure where the dilemma is. Of course the repository should encapsulate the options and anything else database related. Returning only fully populated domain objects.
2
votes
Splitting up large SQLAlchemy model
single responsibility
I'm accustomed to seeing lots of SqlAlchemy model classes
that are narrowly focused on representing rows
and on relational integrity (like foreign keys).
Such classes will only ...
1
vote
Splitting up large SQLAlchemy model
IMO the frame of mind you could have going into this refactor is: "the SQL Alchemy model is responsible for just two things: (1) CRUD DB operations, and (2) validation: ensuring its data is ...
1
vote
Separate business logic from ORM models in SQLAlchemy
I have used this pattern in the past with flask but I think there are a number of issues with your implementation; I think it's better to know the model directly from the class, as this enable you ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
sqlalchemy × 12python × 6
database × 4
orm × 4
flask × 2
object-oriented × 1
unit-testing × 1
domain-driven-design × 1
web-development × 1
database-design × 1
performance × 1
sql × 1
coding-standards × 1
data × 1
class-design × 1
integration-tests × 1
clean-architecture × 1
repository-pattern × 1