Beispiel #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from sitedata.analyseddatabase import createProdAnalysedDataBase
from entities.name_pb2 import RawNameItemInfo, NameItemInfo, GlobalNameInfo
from entities.name_helper import NameHelper

print '############################################################'
print '#################  Load Name Data Base  ####################'
print '############################################################'

_analysedDataBase = createProdAnalysedDataBase()

def getNameDataBase():
    return _nameDataBase

class NameDataBase:
    

    _dataBase = None
    _globalInfo = _analysedDataBase.getGlobalInfo()
    
    def __init__(self):
        global _analysedDataBase
        self._dataBase = _analysedDataBase
    
    def getXingMingInfo(self, xingMing):
        """Get XingMing info, None if does not exist."""
        rawInfo = self._dataBase.getXingMingInfo(xingMing)
        if not rawInfo: return None
        globalInfo = self._dataBase.getGlobalInfo()
Beispiel #2
0
def importResultToDataBase():
    wdb = createProdAnalysedDataBase()
    wdb.importResultFromFile('files/serialized_result')
    wdb.close()
    log.info("Import finish!")