How to store arbitrary name/value key pairs in a Django model?

后端 未结 5 722
没有蜡笔的小新
没有蜡笔的小新 2021-02-03 11:02

I have a fixed data model that has a lot of data fields.

class Widget(Models.model):
    widget_owner = models.ForeignKey(auth.User)
    val1 = models.CharField()
            


        
5条回答
  •  天命终不由人
    2021-02-03 11:12

    It looks like you've reinvented the triple store. I think it's a common thing, as we follow the idea of database flexibility to its natural conclusion. Triple stores tend to be fairly inefficient in relational database systems, but there are systems designed specifically for them.

    http://en.wikipedia.org/wiki/Triplestore

    At the scales you're talking about, your performance is likely to be acceptable, but they don't generally scale well without a specialized DB.

提交回复
热议问题