Package pydo :: Module base :: Class ForeignKey
[show private | hide private]
[frames | no frames]

Class ForeignKey

object --+

descriptor that enables succinct creation of foreign key attributes.
Both single-column and multi-column foreign key associations are supported.

Example usage:

class A(PyDO):
    B=ForeignKey('b_fkey', 'id', B)
    C=ForeignKey(('c_fkey1', 'c_fkey2'), ('key1', 'key2'), C)

a.B # returns B.getUnique(id=a.b_fkey)
a.C # returns C.getUnique(key1=a.c_fkey1, key2=a.c_fkey2)
a.C=my_C_instance # updates a with new values for c_fkey1 and c_fkey2 
a.B=None # equivalent to a.b_fkey=None

Method Summary
  __init__(self, this_side, that_side, kls)
  __get__(self, obj, type_)
  __set__(self, obj, value)
    Inherited from object
x.__delattr__('name') <==> del
x.__getattribute__('name') <==>
x.__hash__() <==> hash(x)
helper for pickle
helper for pickle
x.__repr__() <==> repr(x)
x.__setattr__('name', value) <==> = value
x.__str__() <==> str(x)
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T

Property Summary

Method Details

__init__(self, this_side, that_side, kls)

this_side - name(s) of the column(s) in this PyDO class which references the key of another table
           (type=string or sequence)
that_side - name(s) of the column(s) in the other PyDO class being referenced
           (type=string or sequence)
kls - the other PyDO class

Property Details


Get Method:

Generated by Epydoc 2.0 on Wed Mar 8 10:18:59 2006