-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_data_sources.py
executable file
·32 lines (23 loc) · 1.03 KB
/
add_data_sources.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
SETTINGS = os.getenv("SENZING_ENGINE_CONFIGURATION_JSON", "{}")
try:
sz_factory = SzAbstractFactoryCore("add_data_source", SETTINGS, verbose_logging=False)
sz_configmanager = sz_factory.create_configmanager()
config_id = sz_configmanager.get_default_config_id()
sz_config = sz_configmanager.create_config_from_config_id(config_id)
for data_source in ("CUSTOMERS", "REFERENCE", "WATCHLIST"):
_ = sz_config.add_data_source(data_source)
new_config = sz_config.export()
new_config_id = sz_configmanager.register_config(new_config, INSTANCE_NAME)
sz_configmanager.set_default_config_id(config_id)
sz_config = sz_configmanager.create_config_from_config_id(new_config_id)
response = sz_config.get_data_sources()
print(response)
except SzError as err:
print(f"{err.__class__.__name__} - {err}", file=sys.stderr)