excel - 对数据库中的非结构化表格数据进行建模
问题描述
我有以下格式的数据:
网格可以多达一百万行和大约 10k 列。此外,可能有数千个这样的文档。我认为对这些数据进行建模的最佳方法是使用类似 Excel 的方法,使用 XML 可以得出如下结果:
<sheetData>
<row r="1" spans="1:4" x14ac:dyDescent="0.2">
<c r="A1" s="1" t="s">
<v>0</v> <!-- Means Value of type String (t="s") at
A1 with value found at index 0 in
a sharedStrings reference document -->
</c>
<c r="B1" s="1"/> <!-- Means no data at cell B1 -->
<c r="C1" s="1"/> <!-- Means no data at cell C1 -->
<c r="D1" s="1"/> <!-- Means no data at cell D1 -->
</row>
<row r="2" spans="1:4" x14ac:dyDescent="0.2">
<c r="A2" s="1"/>
<c r="B2" s="1" t="s">
<v>1</v>
</c>
<c r="C2" s="1"/>
<c r="D2" s="1"/>
</row>
<row r="3" spans="1:4" x14ac:dyDescent="0.2">
<c r="A3" s="1"/>
<c r="B3" s="1"/>
<c r="C3" s="1" t="s">
<v>2</v>
</c>
<c r="D3" s="1"/>
</row>
<row r="4" spans="1:4" x14ac:dyDescent="0.2">
<c r="A4" s="1"/>
<c r="B4" s="1"/>
<c r="C4" s="1"/>
<c r="D4" s="1" t="s">
<v>3</v>
</c>
</row>
</sheetData>
Excel xml 中的值是对 sharedStrings 文件的引用,因此<v>1</v>
可以引用字符串“Data”。
我需要允许对这些数据进行的最常见操作是:
- 编辑单元格
- 移动/插入/删除列
- 移动/插入/删除一行
我熟悉电子表格的 EAV 数据模型,但对于上述非结构化数据,我不确定最好的方法。我想 MongoDB 可能与 xml 存储“最相似”,因为它是一个 json 存储,但是保存这些数据的好方法是什么?
我在想的另一种可能性是将其存储在关系数据库中,例如:
- spreadsheet_id
- row
- col
- value
但是,在考虑编辑文档时,这几乎是不可能的,如果我们允许诸如“在位置 0 处插入新行”之类的操作,这实际上需要更新该电子表格的每个值(可能有十亿个) , 只是为了插入一行。
什么可能是存储它的好方法?如果有人知道,谷歌表格如何存储他们的数据?
解决方案
推荐阅读
- python - 从 excel 文件创建数据框
- linux - ALSA 有时在重新启动后不起作用(大约 30 个中的 1 个)
- python - SMTP 出站:欺骗 ipv4 接收者来自
- angular - Angular 11 不会将文件上传到 .NET 5
- model-view-controller - MVC MapRoute 可选参数与默认值一样使用
- python - 如何使 y 轴上的数字显示以百万为单位的值,而不是 matplotlib 中的科学计数法?
- rust - 跟踪工厂及其产品之间所有权的惯用方式是什么?
- ubuntu - Ubuntu 为未连接的 WiFi 适配器应用网络计划
- hive - 如何将 Google Cloud Dataproc 上的 Hive 数据库连接到 Tableau Online,Tableau Bridge 是否有助于实时连接?
- git - 替代 git lfs