Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persisting JSON data (validated with yang model)

I need to persist some configuration data in a database/store. JSON data can be validated with an existing Yang model. One of the requirements is to keep track of each leaf and leaf-list item and quickly rollback to a previous version. Do you think converting to XML and storing in a XML database makes sense? Or should I convert it to key-value store? Any specific database suggestion to make that process easy to marshall/unmarshall between raw data to JSON leveraging the Yang model?

like image 507
tartar Avatar asked Aug 15 '26 02:08

tartar


1 Answers

Persistence and validation must be separated here.

Some databases (like MySQL 5.7) allows to store JSON values and validate JSON objects before insert (but without validation on Yang model, so you just have to validate it in your code before you store the data). And also, any sql-database can support version or timestamp column to help you show the versions and use the proper one.

Sometimes databases can not do all the business logic of your app, and it requires to write code.

like image 200
yvs Avatar answered Aug 17 '26 23:08

yvs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!