Hello-
Is anyone else using one-to-one joins? I rarely run across them, and have a
workaround, but wondering whether there's something else I could be doing. (By
one-to-one joins, I mean A class has an FK to B class, and B class has a join
back that should act like an FK.)
class B(SQLObject):
myA = MultipleJoin('A')
def _get_myA(self):
x = self._SO_get_myA()
try:
return x[0]
except IndexError:
return None
def _set_myA(self, value):
value.myB = self
Of course, this has a couple problems: it's not automated (that could be easily
fixed with a little effort), and it makes no attempt to enforce the 1-1 part
(multiple B's could point at one A, and I'm out of luck when retrieving. But
SQLObject doesn't really support relation-level constraints).
Thoughts?
- Luke
|