Esempio n. 1
0
 def add_database_connection(self, title, desc, dbengine, address, name,
                             user, pwd):
     kwargs = dict(title=title,
                   desc=desc,
                   engine=dbengine,
                   address=address,
                   dbname=name,
                   user=user,
                   pwd=pwd)
     engine.connectToDb(**kwargs)
Esempio n. 2
0
    def connect_to_databases(self, connections_txt):
        # connect to databases defined in the connections file
        dbs = gui.read_database_connection_from_file(connections_txt)
        for db in dbs:
            usr, pwd = self.decrypt_db_username_password(db['username'], db['password'])
            if usr is not None:
                engine.connectToDb(db['name'],db['description'],db['engine'],db['address'],db['database'],usr,pwd)
            else:
                msg = 'Could not resolve database username for %s/%s.  Make sure secret.py is created correcly.' % (db['address'], db['database'])
                sPrint(msg, MessageType.ERROR)

        # load the local database into the engine
        engine.connectToDb(title='ODM2 SQLite (local)', desc='Local SQLite database',
                           engine='sqlite', address=self.local_db_path,
                           dbname=None, user=None,
                           pwd=None, default=True)
Esempio n. 3
0
 def add_database_connection(self, title, desc, dbengine, address, name, user, pwd):
     kwargs = dict(title=title, desc=desc, engine=dbengine, address=address, dbname=name, user=user, pwd=pwd)
     engine.connectToDb(**kwargs)