From 61cbf4bb046e6de7275c078443ff6752a2fccea3 Mon Sep 17 00:00:00 2001 From: Ant Date: Tue, 15 Apr 2025 19:10:29 -0400 Subject: [PATCH] #29 --- CHANGELOG.md | 4 ++++ python/configuration/README.md | 15 ++++----------- python/configuration/add_data_sources.py | 18 ++++++++---------- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26c55b8..db2782f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog], [markdownlint], and this project adheres to [Semantic Versioning]. +### Changed in 0.0.5 + +- Modified configuration examples for new szconfig and szconfigmanager pattern + ### Added to 0.0.4 - C# examples diff --git a/python/configuration/README.md b/python/configuration/README.md index 36ea09d..b586a60 100644 --- a/python/configuration/README.md +++ b/python/configuration/README.md @@ -1,14 +1,7 @@ -# Deleting Data -The deletion snippets outline deleting previously added source records. Deleting source records removes the previously added source record from the system, completes the entity resolution process and persists outcomes in the Senzing repository. - -Deleting a record only requires the data source code and record ID for the record to be deleted. +# Configuration +Configuration related examples. ## Snippets -* **DeleteFutures.py** - * Read and delete source records from a file using multiple threads -* **DeleteLoop.py** - * Basic read and delete source records from a file -* **DeleteWithInfoFutures.py** - * Read and delete source records from a file using multiple threads - * Collect the response from the [with info](../../../README.md#with-info) version of the API and write it to a file +* **add_data_sources.py** + * Add new data source codes. diff --git a/python/configuration/add_data_sources.py b/python/configuration/add_data_sources.py index 1583db9..f7435e9 100755 --- a/python/configuration/add_data_sources.py +++ b/python/configuration/add_data_sources.py @@ -12,23 +12,21 @@ try: - sz_factory = SzAbstractFactoryCore("add_records", SETTINGS, verbose_logging=False) - sz_config = sz_factory.create_config() + sz_factory = SzAbstractFactoryCore("add_data_source", SETTINGS, verbose_logging=False) sz_configmanager = sz_factory.create_configmanager() config_id = sz_configmanager.get_default_config_id() - config_definition = sz_configmanager.get_config(config_id) - config_handle = sz_config.import_config(config_definition) + sz_config = sz_configmanager.create_config_from_config_id(config_id) for data_source in ("CUSTOMERS", "REFERENCE", "WATCHLIST"): - response = sz_config.add_data_source(config_handle, data_source) + _ = sz_config.add_data_source(data_source) - config_definition = sz_config.export_config(config_handle) - config_id = sz_configmanager.add_config(config_definition, INSTANCE_NAME) + new_config = sz_config.export() + new_config_id = sz_configmanager.register_config(new_config, INSTANCE_NAME) sz_configmanager.set_default_config_id(config_id) - response2 = sz_config.get_data_sources(config_handle) - sz_config.close_config(config_handle) - print(response2) + 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)