def CreateEngine(self, BaseClass):
        try:
            engine = create_engine(
                "postgresql+psycopg2://{0}:{1}@{2}:{3}/{4}".format(
                    self._db_settings['DATABASE_USER'],
                    self._db_settings['DATABASE_PASS'],
                    self._db_settings['DATABASE_IP'],
                    self._db_settings['DATABASE_PORT'],
                    self._db_settings['DATABASE_NAME']),
                poolclass=QueuePool,
                pool_size=5,
                max_overflow=10,)
            BaseClass.metadata.create_all(engine)

            # Fix for forking
            register_after_fork(engine, engine.dispose)

            return engine
        except __HOLE__ as e:  # Potentially corrupted DB config.
            self.error_handler.FrameworkAbort(
                'Database configuration file is potentially corrupted. '
                'Please check ' + self.config.FrameworkConfigGet('DATABASE_SETTINGS_FILE') + '\n'
                '[DB] ' + str(e))
        except KeyError:  # Indicates incomplete db config file
            self.error_handler.FrameworkAbort(
                "Incomplete database configuration settings in "
                "" + self.config.FrameworkConfigGet('DATABASE_SETTINGS_FILE'))
        except exc.OperationalError as e:
            self.error_handler.FrameworkAbort(
                "[DB] " + str(e) + "\nRun scripts/db_run.sh to start/setup db")
dataset/ETHPy150Open owtf/owtf/framework/db/db.py/DB.CreateEngine