-
-
Notifications
You must be signed in to change notification settings - Fork 176
ZODB chapter #1894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
ZODB chapter #1894
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
99989b0
ZODB chapter draft
jensens 3baa55b
Merge branch '6.0' into chapter-zodb-v2
jensens 2297ecb
Merge branch '6.0' into chapter-zodb-v2
jensens 91af41e
Merge branch '6.0' into chapter-zodb-v2
stevepiercy 8bd3152
- Convert bullet list to definition list to improve readability and i…
stevepiercy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,76 @@ | ||
--- | ||
myst: | ||
html_meta: | ||
"description": "" | ||
"property=og:description": "" | ||
"property=og:title": "" | ||
"keywords": "" | ||
"description": "Zope Object Database (ZODB)" | ||
"property=og:description": "Zope Object Database (ZODB)" | ||
"property=og:title": "Zope Object Database (ZODB)" | ||
"keywords": "Plone, ZODB, Zope Object Database, RelStorage, ZEO, ZODB Extension Objects" | ||
--- | ||
|
||
% TODO: Diátaxis conceptual guide | ||
|
||
(backend-zodb-label)= | ||
|
||
# ZODB | ||
# Zope Object Database (ZODB) | ||
|
||
The {term}`Zope Object Database` (ZODB) is a Python native, object-oriented database designed for direct persistence of Python objects. | ||
Unlike traditional relational databases that rely on tables and SQL queries, ZODB allows developers to work directly with Python objects, persisting them without the need for object-relational mapping (ORM). | ||
|
||
|
||
## Core features of ZODB | ||
|
||
Transparent persistence | ||
: Objects stored in ZODB automatically persist. | ||
In a Plone request/response cycle, they do not require an explicit save or commit operation, since this is done automatically. | ||
|
||
No schema constraints | ||
: Unlike relational databases, ZODB does not require predefined schemas, allowing for flexible and dynamic data structures. | ||
The attributes of the Python objects themselves are stored. | ||
|
||
ACID compliance | ||
: ZODB ensures data consistency through transactions that support atomicity, consistency, isolation, and durability (ACID). | ||
|
||
Automatic conflict resolution | ||
: With its multi-version concurrency control (MVCC), ZODB can handle concurrent access efficiently. | ||
|
||
Built-in versioning and undo | ||
: The database allows versioning, enabling rollback to previous states if needed. | ||
|
||
Scalability | ||
: ZODB can be used in standalone applications or scaled with {term}`ZODB Extension Objects` (ZEO) for distributed storage. | ||
Additionally, ZODB supports the {term}`RelStorage` adapter, which allows it to use relational databases, including PostgreSQL, MySQL, or Oracle, as a backend, providing flexibility for integration with existing database infrastructures. | ||
|
||
|
||
## How ZODB works | ||
|
||
At its core, ZODB operates as an object store, maintaining serialized Python objects with some metadata in a hierarchical structure. | ||
|
||
Storage | ||
: Handles how objects are stored on disk or in-memory. | ||
|
||
The default storage is {term}`FileStorage`, which writes data to `.fs` files. `FileStorage` does not scale, as only one process can work with it. | ||
|
||
{term}`ZEO` storage is used for distributed multi-client access to the same database, introducing scalability. | ||
|
||
{term}`RelStorage` is another highly scalable option. | ||
It allows ZODB to use relational databases like PostgreSQL, MySQL, or Oracle as backend storage, combining object persistence with traditional database infrastructure. | ||
RelStorage is used often in a containerized deployment environment. | ||
|
||
Connection | ||
: Acts as the interface between Python applications and the database. | ||
With ZEO for each active Zope thread, one connection is established. | ||
Connections are pooled and re-used. | ||
|
||
Transaction manager | ||
: Manages transactional operations, ensuring data integrity. | ||
A transaction normally starts with the request, and ends with the response. | ||
However, in long-running requests with lots of database writes, transactions can be committed in between. | ||
|
||
Indexing and caching | ||
: Optimizes read and write operations for better performance. | ||
Tuning the ZODB cache sizes to hardware environment and the kind of data stored may help to speed up the application. | ||
|
||
|
||
## Further reading | ||
|
||
More information can be found at the official [ZODB website](https://zodb.org/en/latest/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.