entity-attribute-value

Django Rest Framework & Entity–attribute–value model (EAV) Data Model

本秂侑毒 提交于 2019-12-06 01:34:46
from django.db import models # django user from django.contrib.auth.models import User class Entity(models.Model): """ Entity of EAV """ entity = models.CharField(max_length=216, null=False, default='entity_name', name='entity', verbose_name='Entity of EAV', db_index=True, unique=True ) class Asset(models.Model): """ Asset of EAV """ asset = models.CharField(max_length=216, null=False, default='asset', name='asset', verbose_name='Asset of EAV' ) entity = models.ForeignKey(to=Entity) class Meta: unique_together = ("asset", "entity") class Value(models.Model): """ Value of EAV """ value = models

Magento - How to create “decimal” attribute type

送分小仙女□ 提交于 2019-12-05 23:24:00
问题 I've done a bit of searching online but I have not found any answers to this question yet. I have a situation where I need a product attribute that is a decimal value and it must support negative numbers as well as positive and must also be sortable. For some reason, Magento does not have a "decimal" attribute type. The only type that uses decimal values is Price, but that doesn't support negative numbers. If I use "text" as the type, it supports whatever I want, but it doesn't sort properly

Magento EAV: how to hard delete an attribute value?

谁说胖子不能爱 提交于 2019-12-05 19:25:07
Let's ask the question clearly before entering into the details: Is there a way of hard deleting an attribute value from a product? By hard I mean, removing the row from the database and not only setting the value to null or empty. Now, the details: I'm currently confronted to a problem on Magento. Many product in my store have user defined attributes that are not related to the product. For example, let's say we have a bag product, among other products like t-shirts,dresses,pants ,etc.: Our bag product has only configurable 1 attribute: color . Our T-Shirt product has 2 configurable

Make WTForms set field label from database model

为君一笑 提交于 2019-12-05 16:15:13
I have three tables: components , attributes and attribute_values . Each component can have many attribute_values . Each attribute_value belongs to one attribute . Yeah, it's the dreaded EAV pattern... I have created these two forms: class AttributeValueForm(Form): attribute = HiddenField() value = StringField('Value') class ComponentForm(Form): ... non-related fields left out ... attribute_values = FieldList(FormField(AttributeValueForm)) These are the SQLAlchemy models: class Component(db.Model): __tablename__ = 'components' id = db.Column(db.Integer, primary_key=True) ... non-related

Join/Pivot items with EAV table

*爱你&永不变心* 提交于 2019-12-05 15:35:11
I have a table like below which would have the product description ╔════╦══════════════╦══════╗ ║ Id ║ name ║ price║ ╠════╬══════════════╬══════╣ ║ 1 ║ Apple ║ 23 ║ ║ 2 ║ shirt ║ 148 ║ ║ 3 ║ computer ║ 101 ║ ║ 4 ║ printer ║ 959 ║ ╚════╩══════════════╩══════╝ and another table which is holding the attributes like linked by the ID ╔════╦══════════════╦══════╗ ║ Id ║ attr_name ║ Value║ ╠════╬══════════════╬══════╣ ║ 1 ║ color ║ red ║ ║ 1 ║ size ║ xl ║ ║ 1 ║ brand ║ App ║ ║ 2 ║ color ║ blue║ ║ 2 ║ size ║ l ║ ║ 3 ║ color ║ blue║ ║ 3 ║ size ║ xxl ║ ║ 3 ║ brand ║ HP ║ ╚════╩══════════════╩══════╝ Is

Which one to use? EAV or Blobs in the database?

孤者浪人 提交于 2019-12-05 15:09:50
I am currently working to rework the data system of our application. Basically, it is designed so that people can add all the custom fields they want, with only a few constant/always-there fields. Our current design is giving us plenty of maintenance problems. What we do is dynamically(at runtime) add a column to the database for each field. We have to have a meta table and other cruft to maintain all of these dynamic columns. Now we are looking at EAV, but it doesn't seem much better. Basically, we have many different types of fields, so there would be a StringValues, IntegerValues, etc table

Design database based on EAV or XML for objects with variable features in SQL Server?

我的梦境 提交于 2019-12-05 07:15:28
问题 I want to make a database that can store any king of objects and for each classes of objects different features. Giving some of the questions i asked on different forums the solution is http://en.wikipedia.org/wiki/Entity-attribute-value_model or http://en.wikipedia.org/wiki/Xml with some kind of validation before storage. Can you please give me an alternative to the ones above or some advantages or examples that would help decide which of the two methods is the best one in my case? Thanks

Add new values to a attribute option in magento

混江龙づ霸主 提交于 2019-12-04 22:26:45
问题 I am trying to add new values to attribute option in magento using a script to speed up the process since I have over 2,000 manufactuers 回答1: Here is a piece of code that I used to perform exactly this task. Create a custom module (using ModuleCreator as a tool) and then create a mysql4-install-0.1.0.php under the sql/modulename_setup folder. It should contain the following (adapted to your own data, of course!). $installer = new Mage_Eav_Model_Entity_Setup('core_setup'); $installer-

Design of an 'EAV' or 'Class/Concrete Table Inheritance' database for stock control

泄露秘密 提交于 2019-12-04 14:52:46
I am developing a stock control system for a construction project. The storeman is responsible for adding new stock and distributing/returning it to/from employees. The items (and hence their attributes) will be very varied; e.g. steelwork, clothing, plant/machinery, tools, etc. My question is whether to go for a Class/Concrete Table Inheritance or EAV based schema. I don't know what attributes items will have, so presumably a Class/Concrete Table Inheritance approach would require the end user to add new tables to the database (is this possible?). Please see my proposed EAV schema . Would

can we have one attribute with multiple values in an eav design?

我的梦境 提交于 2019-12-04 14:27:55
问题 i am doing a database design using EAV. I am facing an issue when i try to model an entity with attribute having multiple values? For example Entity id | name | description -- | ---- | ------------ 1 | configuration1 | configuration1 Attribute id | entityId | name | type -- | -------- | ---- | ---- 1 | 1 | att1 | string 2 | 1 | att2 | int 3 | 1 | att3 | List<String> (How will i model this?) Value id | attributeId | value -- | ----------- | ----- 1 | 1 | a 2 | 2 | 1 3 | 3 | b 4 | 3 | c 5 | 3 |