基于 SQL Server 的 EAV

发布于 2024-08-03 05:18:05 字数 76 浏览 9 评论 0 原文

我有兴趣在 SQL Server 数据库上使用 EAV 模型。有人能给我指出现有模型/模式的文章或框架吗(我对此对 Saas 不感兴趣)?

I'm interested in playing around with the EAV model over an SQL Server Database. Is anybody able to point me to an article or framework for an existing model/schema (I'm not intrested in Saas for this)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

饮惑 2024-08-10 05:18:05

语义数据建模的最佳实践对于 Perfor...

EAV 是出了名的问题,因为它会导致严重的部署性能和可扩展性问题。链接中的白皮书由 SQL Server 客户咨询团队发布,试图为部署成功的 EAV 模型提供一些指导。

Best Practices for Semantic Data Modeling for Perfor...

EAV is notoriusly problematic as it leads to severe deployment performance and scalability problems. The Whitepaper in the link, released by the SQL Server Customer Advisory Team tries to offer some guidance to deploy a succesful EAV model.

梦毁影碎の 2024-08-10 05:18:05

我还没有使用过它,但是这个 codeplex 项目中有一个包含数据的 EAV 结构示例:

http://eav.codeplex。 com/
“SQL Server 的示例 EAV 模式,具有:表和索引、部分引用完整性、部分数据类型、可更新视图(如普通 SQL 表)”

提供一些可供下载的 SQL 脚本,此处

另外,这篇博文:
“戴夫的 eav 指南”
http://weblogs.sqlteam.com/davidm/articles/12117.aspx

...通过 SQL Server 中的 EAV 示例进行工作,其中包含如何实现类型检查和查询的示例,以及有关理论和 EAV 为何会导致问题的大量讨论。

I haven't used it, but there's an example EAV structure with data in this codeplex project:

http://eav.codeplex.com/
"A sample EAV pattern for SQL Server with: Tables and indexes, Partial referential integrity, Partial data typing, Updatable views (like normal SQL table)"

Provides some SQL scripts to download, here.

Also, this blog post:
"dave’s guide to the eav"
http://weblogs.sqlteam.com/davidm/articles/12117.aspx

... works through an EAV example in SQL Server with examples of how type checking and querying would be implemented, with lots of discussion about the theory and why EAV can cause problems.

寒尘 2024-08-10 05:18:05

为什么不创建一个包含实体列、属性列和值列的非常简单的表:

CREATE TABLE eav(
    entity STRING,
    attribute STRING,
    value STRING);

然后使用某种脚本填充该表以生成一些测试数据。

INSERT INTO eav ('banana','color','yellow');
INSERT INTO eav ('banana','fluffy','no');
INSERT INTO eav ('banana','origin','Guatemala');
INSERT INTO eav ('orange','origin','USA');
INSERT INTO eav ('orange','origin','Mexico');
INSERT INTO eav ('pear','origin','USA');
INSERT INTO eav ('peach','fluffy','yes');

然后尝试在其上运行查询,尝试一下,了解它是如何工作的,等等。

但总的来说,上述数据组织方案并没有真正与关系数据库理论很好地契合。上面的内容更符合文档数据库理论,例如 Couch DB。如果您需要在野外存储/管理 EAV 性质的数据,我会更深入地研究这一点。

Why not create a very simple table with an entity column, an attribute column, and a value column:

CREATE TABLE eav(
    entity STRING,
    attribute STRING,
    value STRING);

And then populate the table using a script of some sort to generate some test data.

INSERT INTO eav ('banana','color','yellow');
INSERT INTO eav ('banana','fluffy','no');
INSERT INTO eav ('banana','origin','Guatemala');
INSERT INTO eav ('orange','origin','USA');
INSERT INTO eav ('orange','origin','Mexico');
INSERT INTO eav ('pear','origin','USA');
INSERT INTO eav ('peach','fluffy','yes');

And then try running queries on it, to play around, learn how it works, etc.

In general though, the above data organization scheme doesn't really mesh well with relational database theory. The above meshes more with document database theory, like Couch DB. I'd look more into that if you need to store/manage data of EAV nature in the wild.

似最初 2024-08-10 05:18:05

我们在 Github 上有一个非常先进、成熟的 EAV 解决方案 - https://github.com/2sic/eav。不过安装起来相当困难,因为它主要用作名为 2sxc(也在 github 上)的内容管理系统的后端。

由于它非常先进,支持许多数据类型、输入类型、通用输入掩码等等,我相信您会发现它非常鼓舞人心。要尝试一下,最好的方法是安装 DNN(.net Web 平台)和 2sxc(DNN 的内容管理系统)。我想你会对一切的可能性感到惊讶。

请注意,整个 UI 是基于 AngularjS 的,因此它是一个非常现代的设置。您还可以在 http://2sxc.org 上找到更多博客/视频。

We have a very advanced, mature EAV solution out there on Github - https://github.com/2sic/eav. It's fairly difficult to just install though, as it's primarily used as the backend of a content management system called 2sxc (also on github).

As it's extremely advanced, supporting many data-types, input-types, generic input masks and more I believe you'll find it very inspiring. To try it out, the best way is to install DNN (a .net web platform) and 2sxc (the content management system for DNN). I think you'll be amazed at what is possible.

Note that the entire UI is AngularjS based, so it's a very modern setup. You can also find more blogs/videos on http://2sxc.org.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文