edelooff / sqlalchemy-json

Full-featured JSON type with mutation tracking for SQLAlchemy
http://variable-scope.com/posts/mutation-tracking-in-nested-json-structures-using-sqlalchemy
BSD 2-Clause "Simplified" License
189 stars 34 forks source link

Support typing #48

Open anil-resero opened 1 year ago

anil-resero commented 1 year ago

Since sqlalchemy 2.0 supports mapped columns, is it possible to add typing support to this library. Currently, if you try :

foo_json: Mapped[Optional[Dict[Any, Any]]] = mapped_column(NestedMutableJson)

You get the following warning: Argument type is partially unknown Argument corresponds to parameter "__name_pos" in function "mapped_column" Argument type is "TypeEngine[Unknown]"Pylance[reportUnknownArgumentType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUnknownArgumentType) (variable) NestedMutableJson: TypeEngine[_T@as_mutable]