Introducing Betwixt: a declarative data transformation layer
TLDR
The first full-featured release of betwixt-data is now on PyPI. Betwixt
gives the translation between your API, application, and database models a first-class home without making those
models depend on one another.
In my years building Python APIs, I've found that I'm describing the same entity across more than one data model. The API endpoints usually have a Pydantic model tailored for RESTful calls while the database has a different representation of the same entity in a SQLAlchemy ORM model. Then, you might even have a mixed bag of external service representations, logging representations, and sometimes event schemas that embed the same entity.
Betwixt solves this problem by providing an explicit, declarative mapping that gathers all of the translation logic for both directions into one place.




