G2Engine

Version 3.x Version 2.x

G2Engine adds, modifies, deletes, and performs various queries on records and entities in the Senzing repository.

from senzing import G2Engine, G2Exception

Initialization

init

init() initializes the G2Engine object. It must be called prior to any other calls.

g2_engine.init(engine_name, senzing_config_json, verbose_logging)
Parameters
  • engine_name: (str) A short name given to this instance of the G2Engine object.
  • senzing_config_json: A JSON string containing configuration parameters.
  • verbose_logging: A boolean which enables diagnostic logging. 0 for no logging; 1 for logging.
Click to expand init() example

initWithConfigID

initWithConfigID() creates and initializes a Senzing instance with a specific configuration.

g2_engine.initWithConfigID(engine_name, senzing_config_json, config_id_bytearray, verbose_logging)
Parameters
  • engine_name: (str) A short name given to this instance of the G2Engine object.
  • senzing_config_json: (str) A JSON string containing configuration parameters.
  • config_id_bytearray: (bytearray) The configID used to initialize the engine.
  • verbose_logging: (bool) A boolean which enables diagnostic logging.
Click to expand initWithConfigID() example

reinit

reinit() reinitializes the engine using a specified initConfigID.

Parameters
  • config_id_bytearray: (bytearray) The configID used to initialize the engine.
Click to expand reinit() example

destroy

destroy() destroys and performs cleanup for the G2Config object and any in-memory configurations.

g2_engine.destroy()
Click to expand destroy() example

primeEngine

primeEngine() forces initialization of the heavier weight internal resources of Senzing.

g2_engine.primeEngine()
Click to expand primeEngine() example

getActiveConfigID

getActiveConfigID() returns an identifier for the loaded Senzing engine configuration, and assign a long integer to a user-designated variable.

g2_engine.getActiveConfigID(config_id_bytearray)
Parameters
  • configuration_id_bytearray: (bytearray) The identifier value for the engine configuration.
Click to expand getActiveConfigID() example

exportConfig

exportConfig() retrieves the Senzing engine’s configuration, and assigns a JSON document to a user-designated buffer containing all relevant configuration information.

g2_engine.exportConfig(response_bytearray, config_id_bytearray)
Parameters
  • response_bytearray: (bytearray) Object to store the output of the method.
  • config_id_bytearray: (bytearray) The identifier value for the engine configuration can be returned here.
Click to expand exportConfig() example