比 SQLite 更简单

发布于 2024-08-16 14:09:16 字数 434 浏览 6 评论 0原文

您是否知道任何类似 SQLite 的数据库以易于阅读的纯文本格式存储数据(例如多行 json 或 yaml)?

我想将一些数据与我的项目一起存储在版本控制系统中,但如果我使用 sqlite,我无法合并不同工作副本中发生的数据更改。

我不想只使用某种配置文件,因为我希望我的程序能够修改这些数据并有效地查询它而无需将所有数据加载到内存中

数据库中的数据可以通过某种 SQL 方言来访问,但这不是必需的。

编辑:

我正在寻找能够为 json/yaml/其他内容构建和维护 index 文件的东西,该文件允许像正确的数据库一样快速访问数据片段。

我还需要修改数据的能力,因此仅允许查询的解决方案是不够的。

Do you know any SQLite-like database that stores its data in easily readable plain text format (like multi-line json or yaml)?

I'd like to store some data along with my project in version control system but if I use sqlite I can't merge data changes that occurred in different working copies.

I don't want to use just some kind of config file because I want my program to be able to modify this data and query it efficiently without loading all data into memory.

Data in database might be accessed through some kind of sql dialect but that is not a requirement.

EDIT:

I am looking for something that builds and maintains index file for json/yaml/whatever that allows for accessing fragments of the data as fast as proper database can do it.

I also require ability to modify the data so solutions that allow only for querying are not enough.

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

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

发布评论

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

评论(7

坐在坟头思考人生 2024-08-23 14:09:16

MongoDB 与 CouchDB 有很多共同点,但更简单。

您可以尝试我的库(小心)http://code.google.com/p/mongodloid/ 让您的生活更加轻松

MongoDB has a lot in common with CouchDB, but simpler.

You can try my library (be careful) http://code.google.com/p/mongodloid/ to make your life even easier

仙女 2024-08-23 14:09:16

这可能不完全是您正在寻找的东西,但我认为像 CouchDB 这样的东西将是此类应用程序的绝佳选择。它是通过 json 查询的,但我不认为存储的数据是可以直接编辑的。

This might not be exactly what you work looking for, but I think something like CouchDB would be an excellent choice for this kind of application. It is queried via json but I don't think the stored data is directly editable.

靖瑶 2024-08-23 14:09:16

大多数编程语言都带有用于序列化和反序列化其本机数据结构的工具。使用它们将数据存储在文本文件中。

这样,您将获得符合您的编程语言并受其支持的数据,而无需缓慢的解析器

例如,在 PHP 中,您可以使用 serialize() 函数将任何数据结构转换为 字符串unserialize() 则相反)。

查询变得像访问本机数据结构一样简单,不需要 SQL 的复杂/缓慢。

Most programming languages come with tools to serialize and unserialize their native data structures. Use those to store the data in text files.

This way you'll have data that is compliant and supported with your programming language without the need of slow parsers.

For example in PHP you could use the serialize() function to turn any data structure into a string (unserialize() does the opposite).

The querying becomes as simple as accessing native data structures, no need for the complication/slowness of SQL.

淡淡離愁欲言轉身 2024-08-23 14:09:16

平面文件数据库表明了这个想法并不太紧张......

我想知道为什么你的要求不包括“将所有数据加载到内存中”。您认为您会有几 GB 的“一些数据”吗?即使是一些 MB 的数据也不应该在内存中加载和维护太多,毕竟浏览器使用大型网页的 Dom 会消耗更多的内存......

我想你可以使用 内存映射文件 以减少内存使用,但保持准确的索引可能更具挑战性。
我想知道以纯文本文件(mbox 格式)存储邮箱的 Thunderbird 是否使用了这种技术。

Flat file database shows that the idea isn't too stretched...

I wonder why your requirements excludes "loading all data into memory". Do you think you will have several GB of "some data"? Even some MB of data shouldn't be too much to load and maintain in memory, after all a browser consumes much more memory with the Dom of a large Web page...

I suppose you can use memory-mapped file to reduce memory usage, but maintaining an accurate index might be more challenging.
I wonder if Thunderbird, which stores the mailboxes in plain text files (mbox format), uses such technique.

往日 2024-08-23 14:09:16

Xml,使用 Linq-To-Xml?

人类可读,可以部分更新或一次性全部读取。

Xml, With Linq-To-Xml?

Human Readable and can be partially updated or read in all at once.

被你宠の有点坏 2024-08-23 14:09:16

在我年轻的时候,存在某种基于 awk 的数据库引擎。它只是一组 shell 脚本。但我不记得它的名字,也不知道它是否兼容 SQL 或免费。

但存储的数据完全基于文本。

我在那里没有找到它,但此链接可能有用:

免费目录数据库

In my youth, there existed some kind of of awk-based database engine. It was just a set of shell-scripts. But I don't remember its name and I don't know if it was SQL-compliant or free.

But the stored data was totally text based.

I did not find it there, but also this link might be of use:

Catalog of free databases

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