是否有 dynamoDB 模式的图表,例如 RDBMS 的 ER 图?

问题描述 投票:0回答:3

我想编写我的 dynamodb 模式的文档。

有一些文档图表还是我应该使用 ER 图?

amazon-web-services amazon-dynamodb
3个回答
8
投票

我认为定义 ER 图是一个很好的做法。您将以一种与数据库无关的方式建立实体及其相互关系。

当您这样做时,我建议创建一个列出以下内容的文档:

  • 访问模式 - 例如,通过电子邮件获取用户、按状态获取订单等。
  • 描述您的主键结构 - 主键 (PK) 和排序键 (SK) 模式是什么?例如 PK ORDER# 定义订单实体,USER# 定义 USER 实体等。
  • 描述任何二级索引(PK/SK 模式)

查看 Alex DeBrie 在他的 AWS 演讲中如何建模他的示例,以获得一个很好的示例。

ER 图是理解数据模型的绝佳参考,我认为每个数据库都应该有一个作为其文档的一部分。对于 DynamoDB,了解访问模式以及如何设计主键来支持访问模式是至关重要的信息。


4
投票

我喜欢亚历克斯的

我在文档生成中使用 PlantUML,可通过 Planttext 在线获取。对我来说最大的好处是你用纯文本制作图表,因此它的差异非常大,与源代码一起签入。

PlantUML 有一个标准 ERD 语法,它是 OO 类图的扩展。我在下面的示例中稍微滥用了它来包含一些子类关系。

@startuml

title Touchgram Content Store

entity Artist {
* Name
* Bio
UsualLicense
}


entity PhysicalGallery {
* Name
* Address
* Contact
Description
}

entity OnlineGallery {
* Name
* WebAddress
Description
}


entity PhysicalProduct {
* Name
Description
}

entity DigitalSale {
* Price
* Timestamp
}
note bottom of DigitalSale : All digital sales\nare totally anonymous\nvia online credit

entity DigitalProduct {
* Name
* DownloadFile
* Price
License
}

entity DigitalAvail {
* Price
* DateRange
Comments
}

Artist }o..|| DigitalProduct
DigitalProduct }o..|| DigitalSale
DigitalProduct }o..|| DigitalAvail
DigitalProduct }o..|{ PhysicalProduct
DigitalProduct <|-- Image
DigitalProduct <|-- Sound
DigitalProduct <|-- VisualEffect
DigitalProduct <|-- Template

Template }o..o{ DigitalProduct : "Uses Other\nProduct"
note bottom of Template : Template Touchgrams\n(eg: greeting cards or memes)\nCan use digital products\nfrom many artists\nso license & sales would\ncascade through

note bottom of DigitalAvail : By default, available\nas soon as in store\nbut restrictions can be added
Artist }o..o{ PhysicalGallery : Exhibits at
Artist }o..o{ OnlineGallery : Advertises
OnlineGallery }o..o{ PhysicalGallery : Advertises
PhysicalProduct }o..o{ OnlineGallery : Sold through
PhysicalProduct }o..o{ PhysicalGallery : Shown at

note "Normally one digital version\nwould exist of a canvas\nbut often offer prints\n\nconversely, more rarely\nmight do several digital\nversions of a work\neg: with different filters\nor even crop portions\n\nWe **do not** handle\nphysical sales" as N1
N1 .. PhysicalProduct
@enduml

0
投票

我也找不到绘制 DynamoDB ER 图的应用程序。

但是,我正在尝试使用draw.io绘制原始的ER图。 如果您可以将其用作参考,我很高兴。

https://github.com/danishi/dynamodb-er-diagram

© www.soinside.com 2019 - 2024. All rights reserved.