Skip to content

#29 #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged

#29 #30

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 4 additions & 11 deletions python/configuration/README.md
Original file line number Diff line number Diff line change
@@ -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.

18 changes: 8 additions & 10 deletions python/configuration/add_data_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading