Exemplo n.º 1
0
def loadDbSession(database_params): 
    logger.info('Initialize new database connection ...')
    sqlalchemy_enginge = 'postgresql+psycopg2://%(user)s:%(password)[email protected]%(host)s:5432/%(db)s'%(database_params)
    try:
        return initializeDb(sqlalchemy_enginge)
    except:
        logger.error('Could not initialize database. Plase check your database settings parameter.')
        raise WrongParameterException('Could not initialize database. Plase check your database settings parameter.')
Exemplo n.º 2
0
 def setUpClass(cls):
     logging.basicConfig(level=logging.DEBUG)
     cls.logger = logging.getLogger('sqlalchemy.engine')
     cls.dbSession = initializeDb(DBCONFIG)
Exemplo n.º 3
0
 def setUpClass(cls):
     cls.sqlalchemy_logger = createLogger('sqlalchemy.engine', logging.DEBUG)
     cls.logger = createLogger('TestUpdateGeorefDataSources', logging.DEBUG)
     cls.dbsession = initializeDb(DBCONFIG)
Exemplo n.º 4
0
    coupledResource = ET.Element(Namespaces['srv']+'coupledResource')
    sv_coupledresource = ET.Element(Namespaces['srv']+'SV_CoupledResource')
    
    operationName = ET.Element(Namespaces['srv']+'operationName')
    operationNameVale = ET.Element(Namespaces['gco']+'CharacterString')
    operationNameVale.text = resourceTitle
    
    identifier = ET.Element(Namespaces['srv']+'identifier')
    identifierValue = ET.Element(Namespaces['gco']+'CharacterString')
    identifierValue.text = resourceId
        
    operationName.append(operationNameVale)
    identifier.append(identifierValue)
    sv_coupledresource.append(operationName)
    sv_coupledresource.append(identifier)
    coupledResource.append(sv_coupledresource)
    rootElement.append(coupledResource)
    
    # at last create and append srv:operatesOn
    operatesOn = ET.Element(Namespaces['srv']+'operatesOn', attrib = {'uuidref':resourceId})
    rootElement.append(operatesOn)   
    return rootElement

if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)
    dbSession = initializeDb(DBCONFIG)
    logger = logging.getLogger('sqlalchemy.engine')
    response = createServiceDescription(TEMPLATE_FILES['service'], dbSession, logger)
    
    print 'Insert service file %s ...'%response
    #gn_transaction_insert(response, GN_SETTINGS['gn_username'], GN_SETTINGS['gn_password'], logger)