Package orm2 :: Module keys :: Class foreign_key
[hide private]
[frames] | no frames]

Class foreign_key

source code

key --+
      |
     foreign_key

The foreign key class knows about two objects: 'me' and 'other'. 'Me' is the dbobj it belongs to (the relataionship's parent object) and 'other' the one that the key refers to (the relationship's child object(s)). The key class's methods attribute[s](), column[s]() and where() refer to the parent object and are also aliased by the my_attribute[s] (etc..) methods. The other_attribute[s] (etc..) methods refer to the child object. Thode methods that yield actual data values need not to be duplicated, because those values are the same in parent and child objects, of course.

Instance Methods [hide private]
  __init__(self, my_dbobj, other_dbclass, my_key_attributes, other_key_attributes)
Each of the attributes sets must point to the same datatypes in the same order to function properly as a foreign key!
  my_attribute_name(self)
  my_attribute_names(self)
  my_attribute(self)
  my_attributes(self)
  my_column(self)
  my_columns(self)
  my_where(self)
  other_attribute_name(self)
  other_attribute_names(self)
  other_attribute(self)
  other_attributes(self)
  other_column(self)
  other_columns(self)
  other_where(self)

Inherited from key: __eq__, attribute, attribute_name, attribute_names, attributes, column, columns, isset, make_tuple, sql_literal, sql_literals, value, values, where

Inherited from key (private): _where


Method Details [hide private]

__init__(self, my_dbobj, other_dbclass, my_key_attributes, other_key_attributes)
(Constructor)

source code 
Each of the attributes sets must point to the same datatypes in the same order to function properly as a foreign key!
Parameters:
  • my_dbobj - The parent dbobj
  • child_dbclass - The child's dbclass (not object...!)
  • my_key_attributes - A tuple of string(s) refering to those of the parent's properties that manage the key column(s).
  • other_key_attributes - A tuple of string(s) refering to those of the child's properties that manage the key column(s).
Overrides: key.__init__

my_attribute_name(self)

source code 
Returns:
An string containing the name of the attribute managing the key column.
Raises:

my_attribute_names(self)

source code 
Returns:
A tuple of strings naming the db attributes managing the key columns.

my_attribute(self)

source code 
Returns:
An datatype instance managing the key attribute.
Raises:

my_attributes(self)

source code 
Returns:
A generator yielding the datatype instances that comprise the key

my_column(self)

source code 
Returns:
An sql.column instance indicating the key's column.
Raises:

my_columns(self)

source code 
Returns:
A tuple of sql.column instances that comprise the key

my_where(self)

source code 
Returns:
sql.where() instance representing a where clause that refers to this key

other_attribute_name(self)

source code 
Returns:
An string containing the name of the attribute managing the key column.
Raises:

other_attribute_names(self)

source code 
Returns:
A tuple of strings naming the db attributes managing the key columns.

other_attribute(self)

source code 
Returns:
An datatype instance managing the key attribute.
Raises:

other_attributes(self)

source code 
Returns:
A generator yielding the datatype instances that comprise the key

other_column(self)

source code 
Returns:
An sql.column instance indicating the key's column.
Raises:

other_columns(self)

source code 
Returns:
A tuple of sql.column instances that comprise the key

other_where(self)

source code 
Returns:
sql.where() instance representing a where clause that refers to this key in the 'other' (child) relation