On May 24, 10:39 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> ill observe that
> the requests for "how do i find the X object given the Y object"
> correspond to applications that are dealing with tables/classes
> anonymously, like people building generic GUIs for traversing a data
> model.

That's exactly what I'm doing.  As it turns out, I can do it all by
traversing tables and never referring to mappers and mapped classes.

> note that the "sqlalchemy" package (where Table is) has no
> dependencies on the "sqlalchemy.orm" package (where Mapper is).  this
> relationship will be more explicitly stated in 0.4.

In that case I won't ask for table -> mapper registry to be added or
even considered!

Here's a related question.  In doing this traversal, I need to
determine whether a given column has a unique constraint on it.
Playing around in the shell, i found that each column object has a
property "unique", but it never has a value when I'm examining it.

I wanted to just do this:
col = table.c.somecolumn
if col.unique:
   do_something(col)
else:
   do_something_else(col)

But unique doesn't seem to be assigned, even though it's there as a
property of the column.  So instead I can do it the long way: get the
table's list of constraints, locate the UniqueConstraints, and see if
the given column is in the keys of any of those UniquConstraints.

Is there a shortcut to that longer way around?
Thanks!



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to