in dataplex-quickstart-labs/00-resources/scripts/python/business-glossary-import/bg_import/glossary.py [0:0]
def clear_glossary(self) -> bool:
"""Remove existing terms and categories from a Data Catalog Business Glossary.
Args:
None.
Returns:
A boolean indicating if the operation succeeded.
"""
logger.info(
'Clearing the existing terms and categories in the target glossary.'
)
tasks = []
for term in self._term_cache.values():
tasks.append((term.term_id,))
for category in self._category_cache.values():
tasks.append((category.category_id,))
ret = Glossary._parallelize(self._remove_glossary_entry, tasks)
for response in ret:
err = response['error_msg']
if err:
logger.error(
'Could not delete entry (term or catgory) from the target glossary.'
)
return False
# Refresh term cache
self._term_cache = {}
self._category_cache = {}
return True