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

Fix column descriptors

Open ilevkivskyi opened this issue 7 years ago • 2 comments

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.

ilevkivskyi avatar Aug 27 '18 15:08 ilevkivskyi

Note: the generated __init__ for models only accepts column values as keyword arguments User(id=1, name='John').

ilevkivskyi avatar Aug 27 '18 16:08 ilevkivskyi

#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).

ilevkivskyi avatar Jan 16 '19 22:01 ilevkivskyi