Thanks,
Is there a more direct way to do this for the Column return type as
well? Now i have:
@staticmethod
def column(cls, name):
for cl in cls.mro():
if hasattr(cl, '__table__'):
for c in cl.__table__.c:
if c.name == name: return c
@staticmethod
def type(obj, name):
try:
return XSALfactory.column(type(obj),
name).type.python_type
except AttributeError:
return type(getattr(obj, name))
(Without the relationship type implemented yet.)
On Mar 30, 1:38 am, Michael Bayer <[email protected]> wrote:
> we're working on a more documented API for getting info like this but at the
> moment it would be:
>
> MyClass.someattribute.property.mapper.class_
>
> On Mar 29, 2012, at 7:16 PM, lars van gemerden wrote:
>
>
>
>
>
>
>
> > I am generating xml from SAclass objects and need to get the return
> > type (referred SA class) of an relationship attribute (even if the
> > returned value is None). The type will be used as tagname during XML
> > generation.
>
> > Can anyone tell me how to get this type?
>
> > Cheers, Lars
>
> > --
> > 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
> > athttp://groups.google.com/group/sqlalchemy?hl=en.
--
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.