-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpurge_repository.py
executable file
·32 lines (23 loc) · 1.04 KB
/
purge_repository.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /usr/bin/env python3
import os
import sys
from pathlib import Path
from senzing import SzError
from senzing_core import SzAbstractFactoryCore
INSTANCE_NAME = Path(__file__).stem
PURGE_MSG = """
**************************************** WARNING ****************************************
This example will purge all currently loaded data from the Senzing datastore!
Before proceeding, all instances of Senzing (custom code, tools, etc.) must be shut down.
*****************************************************************************************
Are you sure you want to continue and purge the Senzing datastore? Type YESPURGESENZING to purge: """
SETTINGS = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
if input(PURGE_MSG) != "YESPURGESENZING":
sys.exit()
try:
sz_factory = SzAbstractFactoryCore(INSTANCE_NAME, SETTINGS, verbose_logging=False)
sz_diagnostic = sz_factory.create_diagnostic()
sz_diagnostic.purge_repository()
print("\nSenzing datastore purged")
except SzError as err:
print(f"\n{err.__class__.__name__} - {err}")