/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
Scraper::base::sa::Att Class Reference

List of all members.

Public Member Functions

def __init__
def range

Public Attributes

 source
 att

Detailed Description

Facilitate determination of a range of an attribute in DB table, 
not necessarily a datetime.

Usage::

    att = Att( source , "date_time" )
    full = att.range()
    past = att.range(ceil=datetime.now())

    print full
    print full.count
    print full.min.ctime()
    print full.max.ctime()

Definition at line 53 of file sa.py.


Constructor & Destructor Documentation

def Scraper::base::sa::Att::__init__ (   self,
  source,
  atn 
)
:param source: SA mapped class
:param atn: name of attribute of the class 

Definition at line 70 of file sa.py.

00071                                     :
00072         """
00073         :param source: SA mapped class
00074         :param atn: name of attribute of the class 
00075         """
00076         self.source = source 
00077         self.att   = getattr( source , atn ) 


Member Function Documentation

def Scraper::base::sa::Att::range (   self,
  floor = None,
  ceil = None,
  filter = None 
)
Make query to determine full range 

:return: SA namedtuple with keys count,min,max

Definition at line 78 of file sa.py.

00079                                                          :
00080         """
00081         Make query to determine full range 
00082 
00083         :return: SA namedtuple with keys count,min,max
00084         """ 
00085         q = self.source.db.session.query(
00086                          func.count().label("count"), 
00087                    func.min(self.att).label("min"), 
00088                    func.max(self.att).label("max")  )
00089         if filter:
00090             q = q.filter( filter )
00091         if floor:
00092             q = q.filter( self.att >= floor )
00093         if ceil:  
00094             q = q.filter( self.att  < ceil )
00095         return q.one()
00096         
00097 


Member Data Documentation

Definition at line 73 of file sa.py.

Definition at line 73 of file sa.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:50:03 for Scraper by doxygen 1.7.4