def delete_datastore(self, datastore_name=None):
        qual_ds_name = self._get_datastore_name(datastore_name)
        log.info('Deleting datastore %s' % datastore_name)

        with psycopg2_connect(c_host=self.host, c_port=self.port, c_dbname=self.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("SELECT table_name FROM information_schema.tables WHERE table_schema='public'")
                table_list = cur.fetchall()
                table_list = [e[0] for e in table_list]
                # print self.database, qual_ds_name, table_list

                table_del = 0
                for table in table_list:
                    if table.startswith(qual_ds_name):
                        statement = "DROP TABLE "+table+" CASCADE"
                        cur.execute(statement)
                        # print self.database, statement, cur.rowcount
                        table_del += abs(cur.rowcount)

        log.debug("Datastore '%s' deleted (%s tables)" % (datastore_name or qual_ds_name, table_del))

        # Good idea but not feasible because of all the still open connections to the database
        #if table_del and not self._list_datastores():
        #    log.error("delete_datastore(): Last datastore deleted, auto-deleting database")
        #    self.pool.closeall()
        #    self.drop_database(self.database, self.default_database,
        #                       self.host, self.port, self.admin_username, self.admin_password)
Return a (fn, fp) pair
dataset/ETHPy150Open ooici/pyon/pyon/datastore/postgresql/base_store.py/PostgresDataStore.delete_datastore--crossover with--dataset/ETHPy150Open DataDog/dogapi/tests/integration/test_dogshell.py/get_temp_file