Hi Folks, I have been scratching my head over this one all day, so any advice would be greatly appreciated!
I have a pretty simple join table setup like this: foo foo_bar bar ------------------------------------------- id id_foo (unique) id id_bar more_stuff It looks like a many-to-many relationship, but it's not, since id_foo is unique in the join table. - There can be any number of 'foo' for each 'bar' - Each 'foo' has exactly one or zero 'bar' I have set up the required declarative stuff, and an association proxy in 'foo' to get to 'bar' in one nice step. Since there can only ever be one (or zero - and this is my problem) I have set it to be a scalar. It all works great, except that if I try and look at the value of the assoication proxy in a 'foo' row without a corresponding 'foo_bar', then I get AttributeError. It is clearly looking for a 'bar' in a 'foo_bar' that is a None (since there is no entry), so is understandable; but in my case not desirable. What I would like to do is to get a 'bar' if one exists, else return a 'None'. Is the only way to do this to write my own wrapper property that does a try/catch? And if I do this, will the property stop being nice and magical (you know, filterable and comparable etc..) I am quite a newcomer to SQLAlchemy so go easy on me! All the best, Philip -- 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.