You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The imperative mapping form is a lesser-used form of mapping that originates from the very first releases of SQLAlchemy in 2006. It’s essentially a means of bypassing the Declarative system to provide a more “barebones” system of mapping, and does not offer modern features such as PEP 484 support. As such, most documentation examples use Declarative forms, and it’s recommended that new users start with Declarative Table configuration.
(Emphasis mine)
The content of this chapter should probably be modified to indicate that.
Also, is there an alternative that would use the recommended Declarative mapping?
The text was updated successfully, but these errors were encountered:
as far as i know the only alternative is to have your domain model classes become sqlalchemy classes, effectively tightly coupling your domain with sqlalchemy. so as always, it's a trade-off...
The data class might be dataclass, attrs or pydantic, all are more general and framework independent, easy to write business logic with or without sqlalchemy or even relational database.
In chapter 02, it's stated that the classical mapping is an alternative to the declarative mapping and that:
See here: https://github.com/cosmicpython/book/blob/master/chapter_02_repository.asciidoc#inverting-the-dependency-orm-depends-on-model
But, in the SQLAlchemy documentation about Imperative/Classical Mapping, the following is stated:
(Emphasis mine)
The content of this chapter should probably be modified to indicate that.
Also, is there an alternative that would use the recommended Declarative mapping?
The text was updated successfully, but these errors were encountered: