Example
#! /usr/bin/env python3
from senzing import G2Engine, G2EngineFlags, G2Exception
# REPLACE /home/user/your_project with the path to your Senzing project
senzing_engine_configuration_json = '{ "PIPELINE": { "CONFIGPATH": "/home/user/your_project/etc", "SUPPORTPATH": "/home/user/your_project/data", "RESOURCEPATH": "/home/user/your_project/resources" }, "SQL": { "CONNECTION": "sqlite3://na:na@/home/user/your_project/var/sqlite/G2C.db" } }'
g2_engine = G2Engine()
datasource_code = 'CUSTOMERS'
record_id = '1001'
g2_engine_example_flag = G2EngineFlags.G2_ENTITY_INCLUDE_ENTITY_NAME
response_bytearray = bytearray()
try:
g2_engine.init("G2Engine", senzing_engine_configuration_json)
g2_engine.getEntityByRecordID(
datasource_code,
record_id,
response_bytearray,
g2_engine_example_flag)
g2_engine.destroy()
except G2Exception as err:
print(err)
print(response_bytearray.decode())
Output
{
"RESOLVED_ENTITY":
{
"ENTITY_ID": 1,
"ENTITY_NAME": "Robert Smith"
}
}