def _create_database(self, database_name):
        log.info("Create database '%s' with admin user '%s'", database_name, self.admin_username)
        with psycopg2_connect(c_host=self.host, c_port=self.port, c_dbname=self.default_database,
                              c_user=self.admin_username, c_password=self.admin_password,
                              tracer=self._call_tracer) as conn:
            conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
            with conn.cursor() as cur:
                cur.execute("CREATE DATABASE %s" % database_name)

        log.info("OK. Initialize database '%s' with admin user '%s'", database_name, self.admin_username)
        with psycopg2_connect(c_host=self.host, c_port=self.port, c_dbname=database_name,
                              c_user=self.admin_username, c_password=self.admin_password,
                              tracer=self._call_tracer, trace_stmt="EXECUTE db_init.sql") as conn2:
            with conn2.cursor() as cur:
                db_init = None
                with open("res/datastore/postgresql/db_init.sql", "r") as f:
                    db_init = f.read()
                if db_init:
                    cur.execute(db_init)

        log.debug("Database '%s' initialized and ready.", database_name)
Created a new Postgres database using the admin user
dataset/ETHPy150Open ooici/pyon/pyon/datastore/postgresql/base_store.py/PostgresDataStore._create_database