pyroxide.orm.datamap (version 52 , 2007-04-10 01:15:16 -0700 (Tue, 10 Apr 2007) )
index
/usr/lib/python2.4/site-packages/pyroxide/orm/datamap.py

Data Map module.
 
A collection of Data Map classes to support mapping objects to a relational
database.  These classes are used by the mapper module.

 
Modules
       
logging
pyroxide

 
Classes
       
__builtin__.object
SimpleDataMap
KeyedDataMap
VersionedDataMap

 
class KeyedDataMap(SimpleDataMap)
    An extension to the SimpleDataMap that supports primary keys.
 
 
Method resolution order:
KeyedDataMap
SimpleDataMap
__builtin__.object

Methods defined here:
__init__(self, domainName, fromClause, keys, groupBy=None, charSet='utf-8')
Initialize a KeyedDataMap.
 
The parameters are the same as for the SimpleDataMap with the addition
of the keys parameter.
 
keys is a tuple of the primary keys in the table.  PLEASE NOTE that
for singular primary keys the tuple must be input as ('key',) where
'key' is the string naming the column that is the primary key.
Without the comma(,) any iteration through the tuple will just
iterate the string.
getBindInsertVals(self, object)
Return a tuple with values to be bound to values clause for insert.
getBindUpdateVals(self, object)
Return a tuple with values to be bound to an update statement.
getKeys(self)
Return the keys for the domain object.
getKeysClause(self)
Return the primary key clause for a single row SQL select.
 
Example: 'id = %s' for a single primary key or
'code = %s and type = %s' for a multi-column primary key.
getRegularColumnMappings(self)
Get the list of column to attribute mappings.
 
The keys columns are excluded from the return list.
hasKeys(self)
Confirm whether keys exist.
listColumnSetClause(self)
Return string representing SQL set statements for all columns.
listColumnValClause(self)
Return the string representing the values clause for a SQL insert.
listColumnsClause(self)
Return string representing the list of columns for a SQL select.

Properties defined here:
keys
get = getKeys(self)
Return the keys for the domain object.

Methods inherited from SimpleDataMap:
addColumn(self, columnArg, attribArg, charSet=None)
Add a column to attribute mapping to the data map.
 
columnArg and attribArg are both strings.
 
charSet is the character set for the field.  If None, it takes the
character set of the tables which is set when initializing the DataMap.
getBindParam(self)
getCharSet(self)
getColumn(self, attribArg)
Return the column that is mapped to the given attribute.
getColumnMapping(self)
Get the list of column to attribute mappings.
getDomainName(self)
Return the name the domain object in the data map.
getFromClause(self)
getGroupByClause(self)
getPlaceHolder(self)
getSqlTimestamp(self)

Properties inherited from SimpleDataMap:
bindParam
get = getBindParam(self)
charSet
get = getCharSet(self)
columnMapping
get = getColumnMapping(self)
Get the list of column to attribute mappings.
domainName
get = getDomainName(self)
Return the name the domain object in the data map.
fromClause
get = getFromClause(self)
groupByClause
get = getGroupByClause(self)
placeHolder
get = getPlaceHolder(self)
sqlTimestamp
get = getSqlTimestamp(self)

Data and other attributes inherited from SimpleDataMap:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'SimpleDataMap' objects>
list of weak references to the object (if defined)

 
class SimpleDataMap(__builtin__.object)
    A simple data mapping class for defining meta-data.
 
This is also the base class used by the KeyedDataMap and the
VersionedDataMap.
 
  Methods defined here:
__init__(self, domainName, fromClause, groupBy=None, charSet='utf-8')
Initialize a new SimpleData object.
 
domainName is the name of the object that is being mapped.
 
fromClause is a string representing the 'FROM' clause of a SQL query.
Essentially it names the tables that correspond to the object that is
being mapped.  It can include 'JOIN' syntax.
 
groupBy is the 'group by' clause (without the actual words 'group by')
if the column mapping include any aggregation functions such as sum(). 
 
charSet is the character set of the tables being mapped.  If there are
different character sets per table then you can use the charSet 
parameter on the individual fields being mapped.
addColumn(self, columnArg, attribArg, charSet=None)
Add a column to attribute mapping to the data map.
 
columnArg and attribArg are both strings.
 
charSet is the character set for the field.  If None, it takes the
character set of the tables which is set when initializing the DataMap.
getBindInsertVals(self, object)
Return a tuple with values to be bound to values clause for insert.
getBindParam(self)
getBindUpdateVals(self, object)
Return a tuple with values to be bound to an update statement.
getCharSet(self)
getColumn(self, attribArg)
Return the column that is mapped to the given attribute.
getColumnMapping(self)
Get the list of column to attribute mappings.
getDomainName(self)
Return the name the domain object in the data map.
getFromClause(self)
getGroupByClause(self)
getPlaceHolder(self)
getRegularColumnMappings(self)
Get the list of column to attribute mappings.
getSqlTimestamp(self)
listColumnSetClause(self)
Return string representing SQL set statements for all columns.
listColumnValClause(self)
Return the string representing the values clause for a SQL insert.
listColumnsClause(self)
Return string representing the list of columns for a SQL select.

Properties defined here:
bindParam
get = getBindParam(self)
charSet
get = getCharSet(self)
columnMapping
get = getColumnMapping(self)
Get the list of column to attribute mappings.
domainName
get = getDomainName(self)
Return the name the domain object in the data map.
fromClause
get = getFromClause(self)
groupByClause
get = getGroupByClause(self)
placeHolder
get = getPlaceHolder(self)
sqlTimestamp
get = getSqlTimestamp(self)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'SimpleDataMap' objects>
list of weak references to the object (if defined)

 
class VersionedDataMap(KeyedDataMap)
    An extension to the KeyedDataMap that supports a 'version' column.
 
The 'version' column is used by the OfflineCurrentMapper.
 
 
Method resolution order:
VersionedDataMap
KeyedDataMap
SimpleDataMap
__builtin__.object

Methods defined here:
__init__(self, domainName, fromClause, keys, groupBy=None, charSet='utf-8')
Initialize a new VersionedDataMap.
 
The parameters are the same as for the KeyedDataMap.
 
Note that for this DataMap the version column must directly follow the
key columns in the mapping.
getBindInsertVals(self, object)
Return a tuple with values to be bound to values clause for insert.
getBindUpdateVals(self, object)
Return a tuple with values to be bound to an update statement.
getKeysVersionClause(self)
Return the primary key clause for an SQL update using versioning.
 
Example: 'id = %s and version = %s'
getRegularColumnMappings(self)
Get the list of column to attribute mappings.
 
The keys and version columns are excluded from the return list.
hasVersion(self)
Confirm whether the version column exists.
listColumnSetClause(self)
Return string representing SQL set statements for all columns.
listColumnValClause(self)
Return the string representing the values clause for a SQL insert.
listColumnsClause(self)
Return string representing the list of columns for a SQL select.

Methods inherited from KeyedDataMap:
getKeys(self)
Return the keys for the domain object.
getKeysClause(self)
Return the primary key clause for a single row SQL select.
 
Example: 'id = %s' for a single primary key or
'code = %s and type = %s' for a multi-column primary key.
hasKeys(self)
Confirm whether keys exist.

Properties inherited from KeyedDataMap:
keys
get = getKeys(self)
Return the keys for the domain object.

Methods inherited from SimpleDataMap:
addColumn(self, columnArg, attribArg, charSet=None)
Add a column to attribute mapping to the data map.
 
columnArg and attribArg are both strings.
 
charSet is the character set for the field.  If None, it takes the
character set of the tables which is set when initializing the DataMap.
getBindParam(self)
getCharSet(self)
getColumn(self, attribArg)
Return the column that is mapped to the given attribute.
getColumnMapping(self)
Get the list of column to attribute mappings.
getDomainName(self)
Return the name the domain object in the data map.
getFromClause(self)
getGroupByClause(self)
getPlaceHolder(self)
getSqlTimestamp(self)

Properties inherited from SimpleDataMap:
bindParam
get = getBindParam(self)
charSet
get = getCharSet(self)
columnMapping
get = getColumnMapping(self)
Get the list of column to attribute mappings.
domainName
get = getDomainName(self)
Return the name the domain object in the data map.
fromClause
get = getFromClause(self)
groupByClause
get = getGroupByClause(self)
placeHolder
get = getPlaceHolder(self)
sqlTimestamp
get = getSqlTimestamp(self)

Data and other attributes inherited from SimpleDataMap:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'SimpleDataMap' objects>
list of weak references to the object (if defined)

 
Data
        SQL = 15
SYS_CREATE_DATE = 'sys_create_date'
SYS_MOD_DATE = 'sys_mod_date'
VERSION = 'version'
__HeadURL__ = '$URL: http://pyroxide.org/svn/pyroxide/trunk/src/main/python/pyroxide/orm/mapper.py $'
__Id__ = '$Id: mapper.py 52 2007-04-10 08:15:16Z kevin $'
__LastChangedBy__ = '$Author: kevin $'
__LastChangedDate__ = '$Date: 2007-04-10 01:15:16 -0700 (Tue, 10 Apr 2007) $'
__Revision__ = '$Rev: 52 $'
__author__ = 'Kevin J. Smith (kevin@rootsmith.ca)'
__copyright__ = '(c) 2007 rootsmith Inc.'
__credits__ = ''
__date__ = ' 2007-04-10 01:15:16 -0700 (Tue, 10 Apr 2007) '
__version__ = ' 52 '

 
Author
        Kevin J. Smith (kevin@rootsmith.ca)

 
Credits