def constructQuery(self): '''Return parts of query to retrieve stream items. Can be overriden in child class.''' table = self.tableName fields = [ft.selectExpr(table, fn) for fn, ft in self.fields.main] condition = self.condition group = self.group if hasattr(self, 'joinTemplate'): table = qUtils.interpolateString(self.joinTemplate, {'brick': self}) condition = self.dbConn.join([condition, getattr(self, 'joinCondition', '')]) if self.joinFields: fields += ["%s.%s" % (self.joinTable, f) \ for f in self.joinFields.keys()] order = self.order and ', '.join( ['%s %s' % (name, dr) for name, dr in self.order]) or '' return table, fields, condition, self.group, order
def getSource(self): """Returns a xml source (file object, file name, or anything compatible with parser, returned by xml.sax.make_parser()""" return qUtils.interpolateString(self.filename, {'site': self.site})