On Tue, Mar 22, 2011 at 05:43:17AM -0700, sandro dentella wrote:
> Hi,
>
> i just "discovered" association_proxy and like it very much. It
> definetely helps in some situations. I already have a library that
> setup gui instrospecting the mapper, to allow editing and filtering of
> records.
>
> the only way I found to get the association_proxy of a class is
> checking its attributes::
>
> for key, value in vars(d.t.mapper.class_).iteritems():
> if isinstance(value, AssociationProxy):
> print key
>
> I can't find a way to get information on the column it is proxying,
> that would be needed to me in order to setup a proper representation:
> how can I find it?
ok, the way is probably:
target_col = obj_proxy.target_class.__table__.c[obj_proxy.value_attr]
Please correct me if this is wrong or just not always right.
This opens some questions on how to use it in a query that I leave for a
separate thread.
sandro
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.