Changes

Jump to: navigation, search

DB-API Database Backend

24 bytes removed, 14:43, 26 September 2016
SQL Details
==SQL Details==
Does the use of DB-API mean that Gramps data are now relational? Does it provide additional data integrity? No. Currently, we are using the SQL engines in exactly the same way that we used BSDDB: all of our data is pickled "blobs" (serialized tuples). However, the flat (non-hierarchical) data is also stored in their own column, and indexes are made on each of those. This allows us to have very fast ad hoc queries on any non-hierarchical data, and JOINS between primary objects. As far as I know, we always did sequential scans in BSDDB. If we connect the SQL WHERE capability up to Filters, then our filters will not require a linear scan through all data. This will be a huge win, but requires a some serious refactoring of views, filters, and the use of the database. Nick is looking at that.
Gramps could have used an SQL abstraction layer, such as SQLAlchemy or Django, but that would be a large dependency for Gramps. The DB-API layer is completely separate; each SQL engine provides its own DB-API interface. As this first step away from BSDDB, we avoided any dependencies. That allows us to write directly in SQL, but also requires that all of the SQL that we do write has to be understood by our SQL engines.

Navigation menu