def delete_dataset(self, source_url_hash): md = session.query(MetaTable).get(source_url_hash) try: dat_table = md.point_table dat_table.drop(engine, checkfirst=True) except NoSuchTableError: # Move on so we can get rid of the metadata pass session.delete(md) try: session.commit() except InternalError, e: raise delete_dataset.retry(exc=e)
def remove_table(self): if self.is_ingested: drop = "DROP TABLE {};".format(self.dataset_name) session.execute(drop) session.delete(self)