简体   繁体   English

便携式非关系数据库

[英]portable non-relational database

I want to experiment/play around with non-relational databases, it'd be best if the solution was: 我想尝试/玩非关系数据库,如果解决方案是:

  • portable, meaning it doesn't require an installation. 便携式,意味着它不需要安装。 ideally just copy-pasting the directory to someplace would make it work. 理想情况下,将目录复制粘贴到某个位置会使其工作。 I don't mind if it requires editing some configuration files or running a configuration tool for first time usage. 我不介意它是否需要编辑一些配置文件或运行配置工具以供首次使用。
  • accessible from python 可从python访问
  • works on both windows and linux 适用于Windows和Linux

What can you recommend for me? 你能为我推荐什么?

Essentially, I would like to be able to install this system on a shared linux server where I have little user privileges. 基本上,我希望能够在我没有用户权限的共享linux服务器上安装此系统。

I recommend you consider BerkelyDB with awareness of the licensing issues. 我建议您考虑一下BerkelyDB 对许可问题的认识。

I am getting very tired of people recommending BerkleyDB without qualification - you can only distribute BDB systems under GPL or some unknown and not publicly visible licensing fee from Oracle. 我对人们在没有资格的情况下推荐BerkleyDB感到非常厌倦 - 你只能在GPL下分发BDB系统,或者从Oracle那里分发一些未知且不公开的许可费用。

For "local" playing around where it is not in use by external parties, it's probably a good idea. 对于在当地没有使用的地方玩“本地”,这可能是一个好主意。 Just be aware that there is a license waiting to bite you. 请注意,有许可证等着咬你。

This is also a reminder that it is a good idea when asking for technology recommendations to say whether or not GPL is acceptable. 这也提醒一下,在询问GPL是否可接受的技术建议时,这是一个好主意。

From my own question about a portable C API database, whilst a range of other products were suggested, none of the embedded ones have Python bindings. 根据我自己关于便携式C API数据库的问题,虽然提出了一系列其他产品,但没有一个嵌入式产品具有Python绑定。

Metakit is an interesting non-relational embedded database that supports Python. Metakit是一个有趣的非关系嵌入式数据库,支持Python。

Installation requires just copying a single shared library and .py file. 安装只需复制一个共享库和.py文件。 It works on Windows, Linux and Mac and is open-source (MIT licensed). 它适用于Windows,Linux和Mac,并且是开源的(MIT许可)。

If you're used to thinking a relational database has to be huge and heavy like PostgreSQL or MySQL, then you'll be pleasantly surprised by SQLite. 如果您习惯于认为关系数据库必须像PostgreSQL或MySQL一样庞大而且很重,那么您会对SQLite感到惊喜。

It is relational, very small, uses a single file, has Python bindings, requires no extra priviledges, and works on Linux, Windows, and many other platforms. 它是关系型的,非常小,使用单个文件,具有Python绑定,不需要额外的权限,并且可以在Linux,Windows和许多其他平台上运行。

Have you looked at CouchDB ? 你看过CouchDB吗? It's non-relational, data can be migrated with relative ease and it has a Python API in the form of couchdb-python . 它是非关系型的,可以相对轻松地迁移数据,并且它具有couchdb-python形式的Python API。 It does have some fairly unusual dependencies in the form of Spidermonkey and Erlang though. 它确实有SpidermonkeyErlang形式的一些相当不寻常的依赖。

As for pure python solutions, I don't know how far along PyDBLite has come but it might be worth checking out nonetheless. 至于纯python解决方案,我不知道PyDBLite已经走了多远,但它仍然值得一试。

BerkeleyDB :(似乎有一个绑定到python的API: http//www.jcea.es/programacion/pybsddb.htm

Adding a reference to TinyDB here since this page is showing at the top of many searches. 在此处添加对TinyDB的引用,因为此页面显示在许多搜索的顶部。 It is a portable non-relational database in python. 它是python中的一个可移植的非关系数据库。 It stores python dicts into a local json file and makes them available for database ops similar to mongodb. 它将python dicts存储到本地json文件中,并使它们可用于类似于mongodb的数据库操作。 It also has an extension to port to mongodb's commands, the difference being that instead of working on another system server you'll be operating on a local json file. 它还有一个扩展到mongodb命令的端口,不同之处在于,不是在另一个系统服务器上工作,你将在本地json文件上运行。

And unlike the presently chosen answer, it is under a permissive MIT open license. 与目前选择的答案不同,它是在许可的麻省理工学院开放许可下。

Links: 链接:

Have you looked at Zope Object Database ? 你看过Zope对象数据库吗?

Also, SQLAlchemy or Django's ORM layer makes schema management over SQLite almost transparent. 此外, SQLAlchemyDjango的ORM层使得对SQLite的模式管理几乎是透明的。


Edit 编辑

Start with http://www.sqlalchemy.org/docs/05/ormtutorial.html#define-and-create-a-table to see how to create SQL tables and how they map to Python objects. http://www.sqlalchemy.org/docs/05/ormtutorial.html#define-and-create-a-table开始,了解如何创建SQL表以及它们如何映射到Python对象。

While your question is vague, your comments seem to indicate that you might want to define the Python objects first, get those to work, then map them to relational schema objects via SQLAlchemy. 虽然您的问题含糊不清,但您的注释似乎表明您可能希望首先定义Python对象,使其工作,然后通过SQLAlchemy将它们映射到关系模式对象。

If you're only coming and going from Python you might think about using Pickle to serialize the objects. 如果您只是来自Python,您可能会考虑使用Pickle来序列化对象。 Not going to work if you're looking to use other tools to access the same data of course. 如果您希望使用其他工具来访问相同的数据,那么就无法工作了。 It's built into python, so you shouldn't have any privileged problems, but it's not a true database so it may not suit the needs of your experiment. 它内置于python中,因此您不应该有任何特权问题,但它不是真正的数据库,因此它可能不适合您的实验需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM