addRecordWithReturnedRecordID() loads a record into the Senzing repository without a record_id parameter, and returns the RECORD_ID of the loaded record.
While the record is not loaded using a record_id parameter, a RECORD_ID can be included in the JSON.
datasource_code: (str) The configured data source for the record.
record_id: (bytearray) Object to store the output of the method.
data_as_json: (str) A JSON document with the attribute data for the record
load_id: (str [optional] ) the observation load ID for the record. The value can be null.
Click to expand `addRecordWithReturnedRecordID()` exampleClick to collapse
Example
#! /usr/bin/env python3from senzing import G2Engine, G2Exception
# REPLACE /home/user/your_project with the path to your Senzing projectsenzing_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'load_id ='Add Record CUSTOMERS no RECORD_ID'data_as_json ='{"ADDR_LINE1":"123 Main Street, Las Vegas NV 89132","ADDR_TYPE":"MAILING","AMOUNT":"100","DATE":"1/2/18","DATE_OF_BIRTH":"12/11/1978","EMAIL_ADDRESS":"[email protected]","PHONE_NUMBER":"702-919-1300","PHONE_TYPE":"HOME","PRIMARY_NAME_FIRST":"Robert","PRIMARY_NAME_LAST":"Smith","RECORD_TYPE":"PERSON","STATUS":"Active","DATA_SOURCE":"CUSTOMERS","ENTITY_TYPE":"GENERIC","DSRC_ACTION":"A"}'record_id = bytearray()
try:
g2_engine.init("G2Engine", senzing_engine_configuration_json)
g2_engine.addRecordWithReturnedRecordID(
datasource_code,
record_id,
data_as_json,
load_id)
g2_engine.destroy()
print(record_id.decode())
except G2Exception as err:
print(err)
Response message:
0792BE1EA1E3FFFEB53AC53AF8199EF26F4C73CA
addRecordWithInfoWithReturnedRecordID
addRecordWithInfoWithReturnedRecordID() loads a record into the Senzing repository without a record_id parameter, and returns the RECORD_ID of the loaded record and a JSON document containing The RECORD_ID and the ENTITY_IDs of the affected entities.
While the record is not loaded using a record_id parameter, a RECORD_ID can be included in the JSON.