On May 24, 2007, at 5:00 PM, Eric Ongerth wrote:
> > > > On May 24, 1:31 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: >> On May 24, 2007, at 2:11 PM, Eric Ongerth wrote: >>> Is there a shortcut to that longer way around? >> >> not at the moment. the tables/columns arent optimized for traversal >> right now. > > Thanks -- I can certainly accept that. > > So then, just out of curiosity, why is it that columns have the > property 'unique' yet accessing it never seems to return any value? > Even on columns which appear in my UniqueConstraints? uh well lets look at the source code. Column.unique *is* assigned if you send the "unique" keyword argument. it transforms the unique keyword argument into a UniqueConstraint when the Column is assigned to its Table via _set_parent. However if you just sent along UniqueConstriant objects to the Table, UniqueConstraint's _set_parent method doesnt do anything with Column's "unique" attribute. plus im not sure how it could, considering that you can have any number of UniqueConstraint objects referencing a particular column. looking at unique=True doesnt really tell you if that column has a UniqueConstraint on it or not since there could be a composite constraint which includes it. so id argue for removing the "unique" attribute from Column altogether, even though its a constructor argument, since its just a shortcut to adding records to the Table's list of constraints and does not accurately reflect the "unique" status of the column in many cases. a better accessor would be a collection of UniqueConstraints which happen to reference the column, and that accessor would just do the work youre already doing when called (i.e. loop thru the table's constraints and match). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---