def getDataSource(): errors = list() sfConfig = { 'username': config.get('salesforce','username'), 'password': config.get('salesforce','password'), 'token': config.get('salesforce','security-token'), 'isSandbox': config.getboolean('salesforce','is-sandbox')} DatabasesList = mssql.listDatabases(config) try: if 'POST' == request.method: SelectedDatabase = request.form['database'] sfConfig = { 'username': request.form['username'], 'password': request.form['password'], 'token': request.form['token']} config.set('salesforce', 'username', sfConfig['username']) config.set('salesforce', 'password', sfConfig['password']) config.set('salesforce', 'security-token', sfConfig['token']) DatabaseSchema = mssql.loadDatabaseSchema(SelectedDatabase, config) SalesforceSchema = salesforce.loadObjectsSchema(config) #save data to cache pickle.dump(DatabaseSchema, open("cache/db_schema.p", "wb")) pickle.dump(SalesforceSchema, open("cache/sf_schema.p", "wb")) return redirect('/entitiesmapping') except Exception, e: errors.append(e.message)
from modules.dialog_mapentities import entitiesMappingDialog from modules.reporter import exportHtml if len(sys.argv) > 1: databaseName = sys.argv[1] else: databaseName = raw_input('Database: ') config = ConfigParser.RawConfigParser() config.read('config.cfg') print 'Connecting to database... \r', databaseSchema = loadDatabaseSchema(databaseName, config) print 'Retrieving salesforce objects schema ... \r', salesforceSchema = loadObjectsSchema(config) print 'Entities mapping... \r', thesaurus = Thesaurus(config.get('matching', 'thesaurus-csv')) advisedMapping = getEntitiesMapping(config, databaseSchema, salesforceSchema, thesaurus) print 'Analisys ... \r', #dialog window is opened here to manually change a mapping advisedMapping = entitiesMappingDialog(config, advisedMapping, databaseSchema, salesforceSchema) advisedMapping = compare(config, advisedMapping, databaseSchema, salesforceSchema,thesaurus) print 'Generation of report ... \r', filename = exportHtml(config, databaseName, advisedMapping, databaseSchema, salesforceSchema) subprocess.call("explorer %s" % filename, shell=True)