Here's a simplified version of the data that I'm working with
{
"name": "Sinistrofu Cloak",
"itemType": "Cloak",
"level": "200",
"stats": [
{
"stat": "Vitality",
"minStat": 251,
"maxStat": 300
},
{
"stat": "Strength",
"minStat": 71,
"maxStat": 100
},
{
"stat": "Wisdom",
"minStat": 16,
"maxStat": 25
}
}
And here's my simplified model:
class ModelItem(Base):
__tablename__ = 'item'
id = Column('id', UUID(as_uuid=True), unique=True, nullable=False, primary_key=True)
name = Column('name', String, nullable=False)
item_type = Column('item_type', String, nullable=False)
level = Column('level', Integer, nullable=False)
stats = Column('stats', JSON)
Most of the fields and how they translate into my database are pretty self evident. I'm really just curious about how I should go about structuring the stats
column. Would it be better to store it as is in JSON format or would it be more proper to create a new stat
model and create a new table for it that links back to the item
model with a foreign key?
To me, it seems a bit unnecessary to do the latter but, as a novice, there may be benefits to it that I don't yet understand