3 ms·
SQLAlchemy is still arguably the most featureful and robust ORM in Python (although it is much more than an ORM). It is likely the best default choice unless yo
by kolanos 2y ago
SQLAlchemy is still arguably the most featureful and robust ORM in Python (although it is much more than an ORM). It is likely the best default choice unless you're already working within a framework that offers its own ORM.
SQLAlchemy does support type annotations [0], am curious what issues you're running into there?
[0]: https://docs.sqlalchemy.org/en/20/orm/extensions/mypy.html https://docs.sqlalchemy.org/en/20/orm/extensions/mypy.html
- kietay 2y agoOne example: ``` class Base(DeclarativeBase): pass class Foo(Base): name: Mapped[str] x = Foo() ``` does not get caught as a type error statically, I'm assuming because all records are treated as mutable. However, `x = Foo(name=2)` also doesn't get caught by pyright, which seems wrong. I could be misusing somehow though.
- kolanos 2y agoI don't think SQLAlchemy officially supports pyright,, although it would be great if they did given all the headaches people have had with mypy.
- kietay 2y agoOh wow, just found the `MappedAsDataclass` release in 2.0. This is exactly what I'm looking for, thanks!