What is the best way to store the characteristics of the goods? For example, to characterize a resistor (an example from my subject area), the attributes are power and resistance, the capacitor is capacitance and voltage, the transistor is a whole bunch of attributes.

My idea:

The essence "subject" stores id, the name and the rest of the goods, the essence "characteristic" refers to it one-to-one and contains all sorts of attributes of the characteristic and their values.

Disadvantages:

Excessive number of NULL values, the number of attributes depends on the type, which is still somehow necessary to check, discarding extra attributes.

  • Similar questions run here at least once a month. look for it. usually still make a vertical table. Object-Attribute-ID-Value. And a directory of possible attributes. But getting attributes is not very convenient, but the search can be unified - Mike
  • And what is your database? In mongo, a variable number of attributes is a natural phenomenon, and no null values ​​for you, maybe you need a document-oriented database instead of attaching crutches instead of wheels to a wheelchair? - Darth
  • @Mike, that is, the table "parameters", "goods" and the third table connecting them? In this case, adding a new capacitor automatically adds two entries to the third table, as I understand it. But where will the information be stored about which product has how many attribute characteristics? - aryndin
  • @Darth relational. I would be happy to hear proven ways to screw Mogno to Flask, such as SQLAlchemy for relationals. - aryndin

0