Hi, devs,
I have a data retrieved from XML file:
{
'1': {'name': 'MAT_A', 'id': 'e65437b3'},
'0': {'name': 'GEO_A', 'id': 'be4c236b'},
'2': {'name': 'MAT_B', 'id': '6e352ed5'}
}
This data could be pulled several times and the number and value of keys might be different.
I have a sqlit3 database for my Python application and I am thinking about storing this data to the database. I come up with such options:
-
Store data in a string cell with
json.dump()
, retrieve data withjson.load()
-
I can create a table with key and values columns and store 0, 1, 2 as keys and create other tables for values. In overall, this solution looks overcomplicated. Also, I will need to clean the key-value table each time I pull the data and I am not sure if itβs Ok.
Can you advise any better solution?