On Apr 20, 2011, at 5:09 PM, Mahmoud Abdelkader wrote:

> for model_property in object_mapper(user).iterate_properties:
>     if isinstance(model_property, ColumnProperty):
>         key = model_property.key
>         dictionary[key] = getattr(user, key)
>     elif (isinstance(model_property, RelationProperty) and 
> model_property.secondary):
>         key = model_property.key
>         dictionary[key] = getattr(user, key)
> 
> print dictionary
> 
> 
> You'll notice the line where it's checking for a relationship property and if 
> the property is actually secondary throws an exception:
> 
>     TypeError: Boolean value of this clause is not defined
> 
> What's the correct way to do what I'm trying to do?

".secondary" points to a Table object and you'll find information about testing 
SQL expression constructs for boolean here:

http://www.sqlalchemy.org/trac/wiki/06Migration#AnImportantExpressionLanguageGotcha




> 
> Thanks!
> Mahmoud
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://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 sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to