1

I have a Django model called Entity. Different types of Entity have different attributes (e.g. some have a currency associated with them, others don't). I'd rather not have to create a new subclass for every permutation of attributes.

Question: Is it a bad design decision to create a CharField or TextField called "attributes" that uses a JSON-encoded map with the attribute names and values for a given entity?

For the purposes of the answer, assume that I don't have many Entity records (~8,000) or users (~100 at one time, worst case) to deal with, so I'm not sure if the performance hit from dealing with a JSON object is a big problem.

1 Answer 1

1

As long as your data set is just an JSON encoded string and not delimited in anyway, I don't see why this would be an issue. You may take a performance hit if you have the field as a blob and your constantly making updates to it. Just note you will lose the ability to search by that field if that was a necessity in your design.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.