4 @link: http://hierarchical-cluster-engine.com/ 5 @copyright: Copyright © 2013-2014 IOIX Ukraine 6 @license: http://hierarchical-cluster-engine.com/license/ 22 ATTR_FETCH_TEMPLATE =
"SELECT * FROM `%s` " 27 super(AttrFetchTask, self).
__init__()
35 def process(self, attrFetches, queryCallback):
37 for attrFetch
in attrFetches:
38 if self.
isSiteExist(attrFetch.siteId, queryCallback):
41 if attrFetch.name
is None:
44 additionWhere = (
"WHERE `Name` = '%s'" % attrFetch.name)
45 logger.debug(
">>> additionWhere = " + str(additionWhere))
46 if additionWhere
is not None and len(additionWhere) > 0:
47 query = AttrFetchTask.ATTR_FETCH_TEMPLATE % (Constants.DC_ATT_TABLE_NAME_TEMPLATE % attrFetch.siteId)
48 res = queryCallback(query + additionWhere, Constants.ATT_DB_ID, Constants.EXEC_NAME)
49 if res
is not None and len(res) > 0:
52 attribute.urlMd5 = elem[
"URLMd5"]
53 attribute.value = elem[
"Value"]
54 attribute.cDate = elem[
"CDate"]
56 except Exception
as excp:
57 logger.debug(
">>> [AttributeFetch] Some Exception = " + str(
type(excp)) +
" " + str(excp))
72 return attrFetchTask.process(attrFetches, queryCallback)
87 attributes = AttrFetchTask.fetchUrlsAttributes(siteId, urlMd5, queryCallback)
88 if isinstance(attributeNames, list):
90 if '*' in attributeNames:
95 for attribute
in attributes:
96 if attribute.name
in attributeNames:
97 localAttributes.append(attribute)
def isSiteExist(self, siteId, queryCallback, userId=None)
def fetchUrlsAttributes(siteId, urlMd5, queryCallback)
def process(self, attrFetches, queryCallback)
def generateCriterionSQL(self, criterions, additionWhere=None, siteId=None)
def fetchUrlsAttributesByNames(siteId, urlMd5, queryCallback, attributeNames)