diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-04-18 16:18:31 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-04-18 16:20:20 -0400 |
| commit | 6f6e2c48ba0be827ee434891f54eb2173edf9bfc (patch) | |
| tree | 49e1271767c5ae3980e768c573f9cba4d7634049 /doc | |
| parent | 243b222a232da0da0ac42386f3f38364750b1fcc (diff) | |
| download | sqlalchemy-6f6e2c48ba0be827ee434891f54eb2173edf9bfc.tar.gz | |
Propagate hybrid properties / info
Keystone and others depend on the .property attribute being
"mirrored" when a @hybrid_property is linked directly to a
mapped attribute. Restore this linkage and also create a defined
behavior for the .info dictionary; it is that of the hybrid itself.
Add this behavioral change to the migration notes.
Change-Id: I8ac34ef52039387230c648866c5ca15d381f7fee
References: #3653
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/changelog/migration_11.rst | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst index be1609130..fffdc4a9d 100644 --- a/doc/build/changelog/migration_11.rst +++ b/doc/build/changelog/migration_11.rst @@ -542,8 +542,8 @@ for an attribute being replaced. .. _change_3653: -Hybrid properties and methods now propagate the docstring ---------------------------------------------------------- +Hybrid properties and methods now propagate the docstring as well as .info +-------------------------------------------------------------------------- A hybrid method or property will now reflect the ``__doc__`` value present in the original docstring:: @@ -582,6 +582,22 @@ for elaborate schemes like that of the recipe, however we'll be looking to see that no other regressions occur for users. +As part of this change, the :attr:`.hybrid_property.info` collection is now +also propagated from the hybrid descriptor itself, rather than from the underlying +expression. That is, accessing ``A.some_name.info`` now returns the same +dictionary that you'd get from ``inspect(A).all_orm_descriptors['some_name'].info``:: + + >>> A.some_name.info['foo'] = 'bar' + >>> from sqlalchemy import inspect + >>> inspect(A).all_orm_descriptors['some_name'].info + {'foo': 'bar'} + +Note that this ``.info`` dictionary is **separate** from that of a mapped attribute +which the hybrid descriptor may be proxying directly; this is a behavioral +change from 1.0. The wrapper will still proxy other useful attributes +of a mirrored attribute such as :attr:`.QueryableAttribute.property` and +:attr:`.QueryableAttribute.class_`. + :ticket:`3653` .. _change_3601: |
