Changes

Jump to: navigation, search

Gramps SQL Database

227 bytes added, 00:21, 31 January 2022
m
no edit summary
This page documents the format of a SQL database version of the GRAMPS Gramps BSDDB datastore. This can be seen as a step towards a [[GEPS 010: SQL Backend]] for GRAMPSGramps, and for supplying data to other applications, such as a [[GEPS 013: Gramps Webapp]].
= GRAMPS Gramps SQL database Overview =
There are two versions of exporting a SQL database: an *An ExportDjango version and an ExportSql/ImportSql ImportDjango version. Currently, the - The ExportDjango /ImportDjango is the latest SQL design. You , and you can access the older functionality plugins through the ''ExportSql'' and ''ImportSql'' programs of the [[Third-party Plugins]] and the . The newer ExportDjango in SVN in [http://svn.code.sfsourceforge.net/p/gramps/codesource/trunkci/master/tree/gramps/webapp/ /trunkmaster/tree/gramps/webapp/], [http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/data/templates/ src/data/templates/] and [http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/data/javascript/ /src/data/javascript/].
== Older *An ExportSql/ImportSql version sample usage ==. - You can access the older functionality through the ''ExportSql'' and ''ImportSql'' programs of the [[Third-party Plugins]].
After dropping the above plugins into your .gramps/plugins subdirectory, you can:
python src== Sample usage ===== Newer Version ===The '''ExportDjango/grampsImportDjango''' version plugins are the latest SQL design.py -O "My Family Tree" -e familytree You can run the ExportDjango plugin in gramps32 once you have the setup finished.sql After initial Django setup in the README in in branch, you can:
This will export the entire contents of your database (not including bookmarks, gramplets, nor any meta data, etc python src/gramps.) into a sqlite3 database named py -O "familytree.sql'My Family Tree" -e ignored. Likewise, you can read the data back in to a new database:django
python src/grampsThis will export the entire contents of your database (not including bookmarks, gramplets, nor any meta data, etc.py -i familytree) into your database.sql
NOTE: if you import this file into an existing family tree, you will get corrupted data for any items that overlap with internal numbering! This has the same effect as importing with GRAMPS XMLExporting a SQL database can take up to 2 seconds per record to output.
Exporting a SQL database can take up to 2 seconds per record to output. Prior to adding indexes and primary keys, importing a SQL database can take up to 1 second a record to read in. However, with === Older version ===The is about the keys and indexes enable, it only takes about 0.01 seconds per recordolder [[Addon:SQLite Export Import|ExportSql/ImportSql]] plugins.
== Newer Version ==After dropping the above plugins into your .gramps/plugins subdirectory, you can:
You can run the ExportDjango plugin in gramps32 once you have the setup finished python src/gramps.py -O "My Family Tree" -e familytree.sql
After initial Django setup in This will export the README in in branchentire contents of your database (not including bookmarks, gramplets, nor any meta data, etc.) into a sqlite3 database named "familytree.sql'. Likewise, you canread the data back in to a new database:
python src/gramps.py -O "My Family Tree" -e ignoredi familytree.djangosql
This will export the entire contents of your database (not including bookmarks, gramplets, nor any meta data, etc.) {{man warn|Warning|If you import this file into your database. There does not yet exist an ImportDjangoexisting family tree, but hopefully later today..you will get corrupted data for any items that overlap with internal numbering! This has the same effect as importing with GRAMPS XML.}}
Exporting a SQL database can take up to 2 seconds per record to output. Prior to adding indexes and primary keys, importing a SQL database can take up to 1 second a record to read in. However, with the keys and indexes enable, it only takes about 0.01 seconds per record.
== External Access ==
</pre>
If you change the data, you can then read it back in and GRAMPS Gramps will reflect the changes.
{{man note|NOTE: |You should only attempt editing textual fields or fields for which you know the meaning. For example, in the above, do not change the handle fields, but you can change one's gender.}}
= Database Structure =
''This section describes the latest SQL schema in the SVN branch.''
The GRAMPS Gramps BSDDB data is broken up into the following tables. The structure and names of the tables and fields were designed to match the naming and operation of the GRAMPS Gramps source code. All of the tables have singular form names (e.g., 'person' rather than 'people').
The schema is created in the [http://svn.code.sf.net/p/gramps/code/trunk/gramps/webapp/grampsdb/models.py /trunk/gramps/webapp/grampsdb/models.py] file as Python code.

Navigation menu