开发者

Simpler than SQLite

开发者 https://www.devze.com 2022-12-15 09:58 出处:网络
Do you know any SQLite-like database that stores its data in easily readable plain text format (like multi-line json or yaml)?

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 开发者_如何学Pythonkind 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.


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


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.


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.


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.


Xml, With Linq-To-Xml?

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


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


Berkeley XML DB? http://www.oracle.com/database/berkeley-db/xml/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消