sqlalchemy-stubs icon indicating copy to clipboard operation
sqlalchemy-stubs copied to clipboard

declarative_base available from sqlalchemy.orm in 1.4

Open philbudne opened this issue 3 years ago • 3 comments

https://docs.sqlalchemy.org/en/14/orm/extensions/declarative/

Changed in version 1.4: The vast majority of the Declarative extension is now integrated into the SQLAlchemy ORM and is importable from the sqlalchemy.orm namespace.

Using the old location (ext.declarative) gives a deprecation warning when SQLALCHEMY_WARN_20 enabled.

philbudne avatar Oct 20 '22 17:10 philbudne

same, can not use from sqlalchemy.orm import declarative_base now, which throws error: Invalid base class "Base" [misc]

Evan6998 avatar Nov 09 '22 06:11 Evan6998

The last update of sqlalchemy.orm.__init__.pyi was 2 years ago, before SQLAlchemy 1.4.0 was released. Wondering if the authors would consider merging a pull request with a fix, although there seem to be a bunch of unanswered PRs.

astrojuanlu avatar Feb 02 '23 15:02 astrojuanlu

Following up here since I'm facing this for the as_declarative -- I get a deprecation warning, but when It ry to import from sqlalchemy.orm the type check fails.

slifty avatar Jul 06 '24 03:07 slifty