DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

ZODB


The Zope Object Database (ZODB) is an object-oriented DBMS library for storing Python objects. ZODB aims to provide a transparent way for Python programmers to make their data persistent. It is completely written by Python, and only provides Python API. It does not support other programming languages. [05][06][07]

Source Code
https://github.com/zopefoundation/ZODB[02]
Country of Origin
US
Start Year
2002 [22]
Project Type
Open Source
Written in
Python
Supported Languages
Python

ZODB stores data as objects, and the relationship between objects are automatically maintained by Python object references. As a result, ZODB allows programmers to manage data structures with complicate relationships.

The storage layer of ZODB is pluggable, and there are three main implementations: ZOE, NOE, and RelStorage. ZOE is a single-server client-server framework using FileStorage; NOE extends ZOE to distributed-server client-server storage; RelStorage stores objects in a relational database backend, such as MySQL, PostgreSQL, and Oracle.

ZODB uses aggressive caching. As a result, it is not suitable for tasks with heavy writes. Also, ZODB is mainly designed for mapping access through keys and attributes of objects, which means that it does not support queries containing joins and advanced search.

Database Entry

ZODB


The Zope Object Database (ZODB) is an object-oriented DBMS library for storing Python objects. ZODB aims to provide a transparent way for Python programmers to make their data persistent. It is completely written by Python, and only provides Python API. It does not support other programming languages.

ZODB stores data as objects, and the relationship between objects are automatically maintained by Python object references. As a result, ZODB allows programmers to manage data structures with complicate relationships.

The storage layer of ZODB is pluggable, and there are three main implementations: ZOE, NOE, and RelStorage. ZOE is a single-server client-server framework using FileStorage; NOE extends ZOE to distributed-server client-server storage; RelStorage stores objects in a relational database backend, such as MySQL, PostgreSQL, and Oracle.

ZODB uses aggressive caching. As a result, it is not suitable for tasks with heavy writes. Also, ZODB is mainly designed for mapping access through keys and attributes of objects, which means that it does not support queries containing joins and advanced search.[05][06][07]

History[08][04][09]


ZODB was a commercial project dated back to the late 90s, which was a part of the Zope web application server. It was made open source as ZODB1 in 2002 and could be used independently. It upgraded to ZODB2 and then to ZODB3 in the same year, 2002. ZODB3 was written in Python and C. It lived until 2012, and then the developers decided to rebuild it into ZODB4 using 100% Python. In 2016, ZODB4 was renamed to ZODB5, which is the current version and is active.

Checkpoints[10]


ZODB does not provide ckeckpoint API.

Compression[11][12]


The default storage FileStorage does not compress the data. It simply appends objects to the end of a file. However, there is an optional layer named zlibstorage which uses gzip to compress the file in the FileStorage. Moreover, since ZODB has a pluggable storage layer, it can support compression by using different storage layers such as NEO and relStorage. NEO implements client-side compression, and RelStorage supports compression using MySQL, PostgreSQL, and Oracle backend.

Concurrency Control[13][08]


ZODB implements MVCC as an additional layer for those pluggable storage layers without MVCC, such as ZEO and NEO. ZODB does not implement MVCC layer for relStorage, which already has MVCC.

Data Model[14]


ZODB stores data as Python objects.

Foreign Keys


Indexes[15]


ZODB does not support building indexes on a set of stored objects. However, there is a variable type named Btree functioning as an index in ZODB. If objects are inserted into a Btree, they are maintained in order, and range queries are supported. Btree has variants: IOBTrees, OIBTrees, and IIBTrees, which are optimized for integer keys and integer values.

Isolation Levels[05]


ZODB supports snapshot isolation with MVCC.

Joins[16][05]


The relationships between objects are automatically maintained by Python object reference, which is a key internal mechanism of Python.

Logging[17]


The default storage layer FileStorage is itself a log-structured file. So there is no need to implement logging in ZODB. For other alternative storage layers, whether they have logging or not is determined by the implementation of their backend.

Query Compilation[05]


ZODB does not support complex queries, so there is no need for query compilation.

Query Interface[05][18]


ZODB only provides Python APIs. Querying for an object in ZODB is similar to querying for a value in a Python dictionary.

Storage Architecture[05][19][17]


ZODB has pluggable storage layers, including ZEO, NEO, relstorage, Directory Storage, Demo Storage, and so on. DemoStorage is used for development and testing, so it is a in-memory storage for convenient. Others are disk-oriented.

Storage Organization[05][17]


It depends on which pluggable storage layer is used. DemoStorage is a copy-on-write storage layer. FileStorage is a log-structured storage layer, which has only one large file for all data.

Stored Procedures[20]


ZODB is used as a Python library. Therefore, Python functions can be viewed as stored procedures for ZODB.

System Architecture[21][07][12]


It depends on which pluggable storage layer is used. The default storage layer ZEO is a single-server model, so it shares everything. There are also distributed-server models written for ZODB, such as NEO and ZRS. NEO and ZRS store data on multiple machines across the Internet, and support data duplication, load-balancing read and fault tolerance. They share the data in the disk.

Views


Compatible Systems
NEO NEO

Citations

22 sources
  1. http://www.zodb.org zodb.org Spam — Check Archive
  2. GitHub - zopefoundation/ZODB: Python object-oriented database · GitHub github.com
  3. http://www.zodb.org/en/latest/reference/index.html zodb.org Dead — Check Archive
  4. Zope Object Database - Wikipedia wikipedia.org
  5. http://www.zodb.org/en/latest/ zodb.org Dead — Check Archive
  6. RelStorage 4.3.1.dev0 documentation readthedocs.io
  7. GitHub - zopefoundation/ZEO: ZODB Client-Server framework · GitHub github.com
  8. ZODB · PyPI pypi.org
  9. ZODB/HISTORY.rst at master · zopefoundation/ZODB · GitHub github.com
  10. http://www.zodb.org/en/latest/reference/zodb.html#zodb-apis zodb.org Dead — Check Archive
  11. http://www.zodb.org/en/latest/reference/storages.html zodb.org Dead — Check Archive
  12. https://neo.nexedi.com nexedi.com Dead — Check Archive
  13. http://www.zodb.org/en/latest/articles/ZODB-overview.html zodb.org Dead — Check Archive
  14. http://www.zodb.org/en/latest/index.html zodb.org Dead — Check Archive
  15. http://www.zodb.org/en/latest/articles/ZODB2.html#persistent-aware-types zodb.org Dead — Check Archive
  16. Variables in Python: Usage and Best Practices – Real Python realpython.com
  17. http://www.zodb.org/en/latest/articles/ZODB-overview.html#storage-options zodb.org Dead — Check Archive
  18. http://www.zodb.org/en/latest/articles/ZODB1.html#a-complete-example zodb.org Dead — Check Archive
  19. https://zodb.readthedocs.io/en/latest/api.html readthedocs.io Dead — Check Archive
  20. http://www.zodb.org/en/latest/articles/ZODB1.html#a-simple-example zodb.org Dead — Check Archive
  21. ZRS - ZODB Replicated Storage — Quintagroup quintagroup.com
  22. ZODB/HISTORY.rst at master · zopefoundation/ZODB · GitHub github.com
Revision #36 Last Updated: