This is because you are using
cdb_... functions, they immediately modify the CDB data. You can modify operational CDB by using the MAAPI: start a new session, open a transaction towards OPERATIONAL, write data, apply the transaction and finish it. This is used in the stats-push example in the ConfD release.
Using transactions means that the data do not appear in the CDB until the
maapi_apply call so if your application is killed before that, no changes make it to the CDB. As a bonus, OPERATIONAL subscribers (if you have them) require this approach, otherwise subscription notifications are not sent.