sqlalchemy-stubs
sqlalchemy-stubs copied to clipboard
Fix column descriptors
We need to add a simple plugin that would replace Column[X] with InstrumentedAttribute[Column[X], X] and make the latter a descriptor instead instead of the former. In addition the plugin would generate a more precise __init__.
The plugin should act only in classes that derive from a declarative base, currently this is not always possible, so the plugin should probably also kick in for classes with fallback to Any.
Note: the generated __init__ for models only accepts column values as keyword arguments User(id=1, name='John').
#49 implemented most of the basic things. The remaining task (replacing Column with InstrumentedAttribute) is low priority (although it is plain lie, it didn't cause any problems in several months).