Package wsatools :: Module DataFactory :: Class View
[hide private]

Class View

source code


Use this class to store a selection of contents from any database table in a local Python data object. Every selected column is stored in a dictionary referenced by column name. Iterating through the container provides access to the data in each row. This class provides an object-oriented alternative to working directly of the list of tuples result set from a database query, making code that operates on result sets containing multiple attributes much more clear.

Instance Methods [hide private]
new empty dictionary

__init__(self, colHeader, rowList)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
object
__getitem__(self, attr)
Returns: Value of attribute for current row, if iterating, else a list of values for all rows.
source code
 
__iter__(self)
This class can be iterated.
source code
int
__len__(self)
Returns: Number of rows stored in this container.
source code
 
next(self)
Iterate through rows.
source code
list of D's values
values(self) source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __le__, __lt__, __ne__, __new__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, colHeader, rowList)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns:
new empty dictionary

Overrides: object.__init__
(inherited documentation)

__getitem__(self, attr)
(Indexing operator)

source code 

x[y]

Returns: object
Value of attribute for current row, if iterating, else a list of values for all rows.
Overrides: dict.__getitem__

__iter__(self)

source code 

This class can be iterated.

Overrides: dict.__iter__

__len__(self)
(Length operator)

source code 

len(x)

Returns: int
Number of rows stored in this container.
Overrides: dict.__len__

values(self)

source code 
Returns: list of D's values
Overrides: dict.values
(inherited documentation)