CI and CI relationship push using Python Script Directly to MS SQL Database

I am creating an external python script to directly push CIs and CI relationships in JSON object (called via uCMDB REST calls) to tables in MS SQL database like (Node-->running software), (Node-->installed software) May i know how can i achieve this as i also need to have a logic in script to only push delta sync (changes, additions or deletions ) post full Insert is done. (INSERT/UPDATE ) in database. Please help how i can use this in case of CI and CI relationship push to database using a python script.