[storm] Best way to implement One-to-one relationships?
Mac Ryan
quasipedia at gmail.com
Thu Aug 27 00:53:30 BST 2009
Hello everybody,
I am new to the list, new to Storm and fairly new to python...
somewhere else I would be called a "n00b"! :)
I would like to receive some input on the best way to implement
one-to-one relationships between tables. I know that one-to-one could be
a single table... but I am writing a routine for importing in another
application DB, so I have no choice...
The structure of my DB is:
TableA - id(primary), field1, field2
TableB - id(primary), field3, field4, field5...
where each id is - in a way - the foreign key from the other table.
Currently I implemented it writing in TableA definition:
extra_fields = Reference(id, TableB.id)
but this implies that when I create ta = TableA() I have my extra
fields into a sort of "subtree": ta.field1, ta.field2,
ta.extra_fields.field3, ta.extra_fields.field4, etc... while I would
like to have them flat at the same level, with ta.field3 and ta.field4
instead.
However I could not think of any straightforward method to achieve
this.
Any pointers/help very much appreciated! :)
Mac.
More information about the storm
mailing list