Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A backend for ZODB that stores pickles in a relational database.

Project description

RelStorage is a storage implementation for ZODB that stores pickles in a relational database (RDBMS). PostgreSQL 9.6 and above, MySQL 5.7.19 / 8.0, Oracle 10g and above, and SQLite 3.8.3 and above are currently supported. RelStorage replaced the PGStorage project.

Features

  • It is a drop-in replacement for FileStorage and ZEO, with several enhancements:
    • Supports undo, packing, and object history preservation just like FileStorage.
    • RelStorage can be configured not to keep object histories for reduced disk space usage and improved performance.
    • Multiple processes on a single machine can read and write a local ZODB database using SQLite without needing to start and manage another process (i.e., ZEO).
    • Blobs can be stored on a shared filesystem, or (recommended) in the relational database and only cached locally.
    • Multiple threads in the same process share a high-performance in-memory pickle cache to reduce the number of queries to the RDBMS. This is similar to ZEO, and the ZEO cache trace tools are supported.
    • The in-memory pickle cache can be saved to disk and read when a process starts up. This can dramatically speed up site warmup time by eliminating a flood of RDBMS queries. Unlike ZEO, this cache is automatically shared by all processes on the machine (no need to configure separate client identifiers.)
  • Ideal for large, high volume sites.
    • Multiple Python processes on multiple machines can read and write the same ZODB database concurrently. This is similar to ZEO, but RelStorage does not require ZEO.
    • Supports ZODB 5’s parallel commit feature: Database writers only block each other when they would conflict (except for a small window at the end of the twophase commit protocol when the transaction ID is allocated; that still requires a global database lock).
    • According to some tests, RelStorage handles concurrency better than the standard combination of ZEO and FileStorage.
    • Whereas FileStorage takes longer to start as the database grows due to an in-memory index of all objects, RelStorage starts quickly regardless of database size.
    • Capable of failover to replicated SQL databases.
  • Tested integration with gevent for PostgreSQL and MySQL.
  • There is a simple way (zodbconvert) to (incrementally) convert FileStorage to RelStorage and back again. You can also convert a RelStorage instance to a different relational database. This is a general tool that can be used to convert between any two ZODB storage implementations.
  • There is a simple way (zodbpack) to pack databases.
  • Supports zodburi .
  • Free, open source (ZPL 2.1)

Features Supported by Databases

Some of RelStorage’s features are only supported on certain versions of certain databases. If the database doesn’t support the feature, RelStorage will still work, but possibly with a performance penalty.

Supported Features
  Parallel Commit Shared readCurrent locks Non-blocking readCurrent locks Streaming blobs Central transaction ID allocation Atomic lock and commit without Python involvement
PostgreSQL Yes Yes Yes With psycopg2 driver Yes Yes, except with PG8000 driver
MySQL Yes Yes Native on MySQL 8.0, emulated on MySQL 5.7 No, emulated via chunking Yes Yes
Oracle Yes No Yes Yes No (could probably be implemented) No (could probably be implemented)
SQLite No No N/A (there is no distinction in lock types) No, consider using a shared-blob-dir N/A (essentially yes because it happens on one machine) No

Documentation

Documentation including installation instructions is hosted on readthedocs.

The complete changelog is also there.

https://readthedocs.org/projects/relstorage/badge/?version=latest

Development

RelStorage is hosted at GitHub:

https://github.com/zodb/relstorage

Continuous integration

A test suite is run for every push and pull request submitted. Travis CI is used to test on Linux, and AppVeyor runs the builds on Windows.

https://travis-ci.org/zodb/relstorage.svg?branch=master https://ci.appveyor.com/api/projects/status/pccddlgujdoqvl83?svg=true

Builds on Travis CI automatically submit updates to coveralls.io to monitor test coverage.

https://coveralls.io/repos/zodb/relstorage/badge.svg?branch=master&service=github

Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for RelStorage, version 3.0.0
Filename, size File type Python version Upload date Hashes
Filename, size RelStorage-3.0.0-cp27-cp27m-macosx_10_9_x86_64.whl (753.3 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27m-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27m-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27mu-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27mu-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27m-win32.whl (733.7 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp27-cp27m-win_amd64.whl (744.6 kB) File type Wheel Python version cp27 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp34-cp34m-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp34-cp34m-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp34 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp35-cp35m-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp35-cp35m-win32.whl (734.1 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp35-cp35m-win_amd64.whl (743.7 kB) File type Wheel Python version cp35 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp36-cp36m-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp36-cp36m-win32.whl (734.6 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp36-cp36m-win_amd64.whl (744.1 kB) File type Wheel Python version cp36 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (752.7 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp37-cp37m-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp37-cp37m-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp37-cp37m-win32.whl (734.4 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp37-cp37m-win_amd64.whl (743.9 kB) File type Wheel Python version cp37 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp38-cp38-macosx_10_9_x86_64.whl (753.3 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp38-cp38-manylinux1_x86_64.whl (1.5 MB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp38-cp38-manylinux2010_x86_64.whl (1.5 MB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp38-cp38-win32.whl (735.1 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-cp38-cp38-win_amd64.whl (745.5 kB) File type Wheel Python version cp38 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0-pp271-pypy_41-macosx_10_14_x86_64.whl (740.5 kB) File type Wheel Python version pp271 Upload date Hashes View hashes
Filename, size RelStorage-3.0.0.tar.gz (1.4 MB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page