<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">I'm not sure about other DB backends, but postgres supports also unique/check constraints to be inspected on db. Any change to get this into SA?</p>
<p dir="auto"><strong>Migrated issue, originally created by Brendan Abel (<a href="https://github.com/babel">@babel</a>)</strong></p>
<p dir="auto">This is using sqlalchemy 0.9.8</p>
<p dir="auto">Assuming a declarative class called "MyClass" with an association proxy field call "my_field"</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; ap = MyClass.__mapper__.all_orm_descriptors['my_field']
&gt;&gt;&gt; ap.owning_class
None

&gt;&gt;&gt; ap = MyClass.my_field
&gt;&gt;&gt; ap.owning_class
&lt;class 'MyClass'&gt;

&gt;&gt;&gt; ap = MyClass.__mapper__.all_orm_descriptors['my_field']
&gt;&gt;&gt; ap.owning_class
&lt;class 'MyClass'&gt;"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; ap = MyClass.__mapper__.all_orm_descriptors['my_field']
&gt;&gt;&gt; ap.owning_class
None

&gt;&gt;&gt; ap = MyClass.my_field
&gt;&gt;&gt; ap.owning_class
&lt;class 'MyClass'&gt;

&gt;&gt;&gt; ap = MyClass.__mapper__.all_orm_descriptors['my_field']
&gt;&gt;&gt; ap.owning_class
&lt;class 'MyClass'&gt;
</code></pre></div>
<p dir="auto">Without the owning_class set, most of the other properties will raise exceptions when trying to access them.  This can be problematic when using the mapper class to procedurally access fields via the mapper.</p>
<hr>
<p dir="auto">Attachments: <a href="../wiki/imported_issue_attachments/3423/rework_attribute_proxy_owner.patch">rework_attribute_proxy_owner.patch</a> | <a href="../wiki/imported_issue_attachments/3423/aptest.py">aptest.py</a></p>