Changes

Jump to: navigation, search

DB-API Database Backend

349 bytes added, 04:34, 23 December 2020
m
no edit summary
Gramps 5.0 comes .x came with a new, alternative database backend called DB-API(Python Database API Specification). The Gramps 5.0.x default database will be remained the old standard Berkeley DB (often abbreviated as [[Gramps_Glossary#bsddb|BSDDB]]).
Testing with Gramps 5.0 is the initial test of .x showed the DB-API backend. If it works , worked well, then and with the release of Gramps 5.1 may make it .x the SQLite DB-API backend was made the default.
What is DB-API? DB-API is a very loose standard to connect to "SQL engines". DB-API doesn't standardize any of the SQL, but merely standardizes the ability to connect, query, and get results back. You can read more about the [https://www.python.org/dev/peps/pep-0249/ DB-API specification].
Gramps has been designed to work with two one DB-API SQL enginesengine:
* sqlite3 SQLite3 - single or multi-user on single operating system* [[DB-API_Database_Backend#Postgresql|postgresql]] - local or remote, single or multi-user
sqlite3 And experimental Addons have been provided for:* [[DB-API_Database_Backend#Postgresql|postgresql]] - local or remote, single(supported by Gramps) or multi-user(not possible with Gramps without a rewrite of the software.)* [[MongoDB]] - ?? SQLite3 has been tested the most and is the default SQL enginerecommended for use with the DB-API Database Backend. However, advanced users can adjust the details of the SQL connect. See [[#Advanced uses]] for more details.
==Scenarios==
Gramps 5.0 provides the opportunity to set up your databases in many different configurations. Some possible uses:
# Users will just use DB-API with the default sqliteSQLite. Nothing will really be different from previous uses of BSDDB, but there is no lock file, and the data is much less likely to become corrupted. # Users can share their sqlite SQLite file on a single file system. Any user logged into that computer can work together on the same file. Operations like import will lock the file, but individual edits can be made simultaneously. Note: there is no code to prevent editing the same record at the same time. For sqliteSQLite, we would have to implement our own row-locking code. Or perhaps just give a warning if the data has changed since we started editing it.# Users can put their sqlite SQLite database on a file-sharing drive, like Dropbox, Google Drive, etc. This is tricky to understand. These systems are file-sharing, not record-sharing. That means that you can't have two users writing at the same time. In fact, if you have two users writing, you probably want to keep the session short. Start grampsGramps, make changes, exit. Or just browse. Or take turns.# Multiple users can use postgresql Postgresql locally. This is relatively speedy, but only really useful if the database is also made available over the network. Otherwise, you would probably just use sqliteSQLite.# Multiple users can use postgresql Postgresql remotely. This is the most powerful option, but also the slowest. Gramps is currently written in a manner that assumes a fast, local connection to the database. Over time, we can refine Gramps code to support this mode better, which will make the other uses faster as well. In any event, this mode should work well, once you have your large data loaded. All operations should work as normal.
There are other possibilities, and even combinations of the above.
Once you have a database, you can edit the <code>settings.ini</code> file in your <code>grampsdb/*/</code> directory.
See: https://github.com/gramps-project/gramps/blobtree/master/gramps/plugins/db/dbapi/settings.py
Valid config key settings:
;BSDDB (Default):<code>database.backend:bsddb</code>
PostgreSQL;SQLite3:<code>database.backend:postgresqlsqlite</code>
SQLite3;PostgreSQL:<code>database.backend:sqlitepostgresql</code>
;MongoDB:<code>database.backend:mongodb</code>
===Postgresql===
4,529
edits

Navigation menu