Friday, 15 February 2013

python - Plant table, many types of plant, each plant has many attributes, some attributes have multiple values -


I have a model that represents the plant, each plant has a type (flower, tree, broom, etc.) . The requirements of the set of attributes are different in the type of each plant, some of which may have multiple values ​​(dwelling place, located areas, etc.) in a plant. For example, trees are unlikely to have more than one type of life cycle, where the life cycle of flowers is different.


How do I go about the model of my data where:

  1. All plants are in the same model
  2. Different types of Set the elements of the type of plants
    1. In those features in the set, some of them may have multiple values ​​per plant, but all require at least one.
    2. After adding new plant types, the ability to create new features, create new sets or reuse old features

      So far, I have a table for plants, many of which have many relationships with each property in their table and I will apply at least one value to the code.


      I have thought of using Entitie-attribute-value for attributes, but then I would not really have the advantage of using ORM (SQLLame ) Also with serialized LOB

      I think I need the class table heritage, but I'm not sure that there can be many values ​​in a systematic way with some attributes. Plant Accommodation ----- | - & gt; - & gt; ------- - & gt; Multiple prices per plant. | Flower Life Cycle | - & gt; ------ - & gt; ---------- - & gt; Single Value | | Tree cone type | - & gt; ---- - & gt; --------- - & gt; Single value | | Bush | - & gt; -----

      Another possibility is to add attribute tables for each new feature while running, but I'm not sure how complete SQLite or any other ORM

      look for docs. The plant will be a base square, and flowers, bush, trees can have their own table. Any foreign key relationships that may be required in each sub-plant table.

      No comments:

      Post a Comment