Skip to content

Instantly share code, notes, and snippets.

@himslm01
Last active May 8, 2026 15:19
Show Gist options
  • Select an option

  • Save himslm01/7f00c001757429cd2a43e5856bb1593f to your computer and use it in GitHub Desktop.

Select an option

Save himslm01/7f00c001757429cd2a43e5856bb1593f to your computer and use it in GitHub Desktop.
Gramps: export to SQLite → constants
DROP TABLE IF EXISTS constants
;
CREATE TABLE constants (
table_name CHARACTER(25),
column_name CHARACTER(25),
code INTEGER,
value TEXT)
;
INSERT INTO constants (table_name, column_name, code, value) VALUES
('citation', 'confidence', 0, 'Very low'),
('citation', 'confidence', 1, 'Low'),
('citation', 'confidence', 2, 'Normal'),
('citation', 'confidence', 3, 'High'),
('citation', 'confidence', 4, 'Very high'),
('date', 'quality', 0, 'Regular'),
('date', 'quality', 1, 'Estimated'),
('date', 'quality', 2, 'Calculated'),
('date', 'modifier', 0, 'Regular'),
('date', 'modifier', 1, 'Before'),
('date', 'modifier', 2, 'After'),
('date', 'modifier', 3, 'About'),
('date', 'modifier', 4, 'Range'),
('date', 'modifier', 5, 'Span'),
('date', 'modifier', 6, 'Text only'),
('date', 'newyear', 0, 'January 1'),
('date', 'newyear', 1, 'March 1'),
('date', 'newyear', 2, 'March 25'),
('date', 'newyear', 3, 'September 1'),
('date', 'calendar', 0, 'Gregorian'),
('date', 'calendar', 1, 'Julian'),
('date', 'calendar', 2, 'Hebrew'),
('date', 'calendar', 3, 'French'),
('date', 'calendar', 4, 'Persian'),
('date', 'calendar', 5, 'Islamic'),
('date', 'calendar', 6, 'Swedish'),
('event_ref', 'role0', -1, 'Unknown'),
('event_ref', 'role0', 0, 'Custom'),
('event_ref', 'role0', 1, 'Primary'),
('event_ref', 'role0', 2, 'Clergy'),
('event_ref', 'role0', 3, 'Celebrant'),
('event_ref', 'role0', 4, 'Aide'),
('event_ref', 'role0', 5, 'Bride'),
('event_ref', 'role0', 6, 'Groom'),
('event_ref', 'role0', 7, 'Witness'),
('event_ref', 'role0', 8, 'Family'),
('event_ref', 'role0', 9, 'Informant'),
('event_ref', 'role0', 10, 'Godparent'),
('event_ref', 'role0', 11, 'Father'),
('event_ref', 'role0', 12, 'Mother'),
('event_ref', 'role0', 13, 'Parent'),
('event_ref', 'role0', 14, 'Child'),
('event_ref', 'role0', 15, 'Multiple birth'),
('event_ref', 'role0', 16, 'Friend'),
('event_ref', 'role0', 17, 'Neighbor'),
('event_ref', 'role0', 18, 'Officiator'),
('event', 'the_type0', -1, 'Unknown'),
('event', 'the_type0', 0, 'Custom'),
('event', 'the_type0', 1, 'Marriage'),
('event', 'the_type0', 2, 'Marriage Settlement'),
('event', 'the_type0', 3, 'Marriage License'),
('event', 'the_type0', 4, 'Marriage Contract'),
('event', 'the_type0', 5, 'Marriage Banns'),
('event', 'the_type0', 6, 'Engagement'),
('event', 'the_type0', 7, 'Divorce'),
('event', 'the_type0', 8, 'Divorce Filing'),
('event', 'the_type0', 9, 'Annulment'),
('event', 'the_type0', 10, 'Alternate Marriage'),
('event', 'the_type0', 11, 'Adopted'),
('event', 'the_type0', 12, 'Birth'),
('event', 'the_type0', 13, 'Death'),
('event', 'the_type0', 14, 'Adult Christening'),
('event', 'the_type0', 15, 'Baptism'),
('event', 'the_type0', 16, 'Bar Mitzvah'),
('event', 'the_type0', 17, 'Bas Mitzvah'),
('event', 'the_type0', 18, 'Blessing'),
('event', 'the_type0', 19, 'Burial'),
('event', 'the_type0', 20, 'Cause Of Death'),
('event', 'the_type0', 21, 'Census'),
('event', 'the_type0', 22, 'Christening'),
('event', 'the_type0', 23, 'Confirmation'),
('event', 'the_type0', 24, 'Cremation'),
('event', 'the_type0', 25, 'Degree'),
('event', 'the_type0', 26, 'Education'),
('event', 'the_type0', 27, 'Elected'),
('event', 'the_type0', 28, 'Emigration'),
('event', 'the_type0', 29, 'First Communion'),
('event', 'the_type0', 30, 'Immigration'),
('event', 'the_type0', 31, 'Graduation'),
('event', 'the_type0', 32, 'Medical Information'),
('event', 'the_type0', 33, 'Military Service'),
('event', 'the_type0', 34, 'Naturalization'),
('event', 'the_type0', 35, 'Nobility Title'),
('event', 'the_type0', 36, 'Number of Marriages'),
('event', 'the_type0', 37, 'Occupation'),
('event', 'the_type0', 38, 'Ordination'),
('event', 'the_type0', 39, 'Probate'),
('event', 'the_type0', 40, 'Property'),
('event', 'the_type0', 41, 'Religion'),
('event', 'the_type0', 42, 'Residence'),
('event', 'the_type0', 43, 'Retirement'),
('event', 'the_type0', 44, 'Will'),
('event', 'the_type0', 45, 'Stillbirth'),
('family', 'the_type0', 0, 'Married'),
('family', 'the_type0', 1, 'Unmarried'),
('family', 'the_type0', 2, 'Civil Union'),
('family', 'the_type0', 3, 'Unknown'),
('family', 'the_type0', 4, 'Custom'),
('name', 'display_as', 0, 'Default'),
('name', 'display_as', 1, 'Surname, Given Suffix'),
('name', 'display_as', 2, 'Given Surname Suffix'),
('name', 'display_as', 4, 'Given'),
('name', 'display_as', 5, 'Main Surnames, Given Patronymic Suffix Prefix'),
('name', 'sort_as', 0, 'Default'),
('name', 'sort_as', 1, 'Surname, Given Suffix'),
('name', 'sort_as', 2, 'Given Surname Suffix'),
('name', 'sort_as', 4, 'Given'),
('name', 'sort_as', 5, 'Main Surnames, Given Patronymic Suffix Prefix'),
('name', 'name_type0', -1, 'Unknown'),
('name', 'name_type0', 0, 'Custom'),
('name', 'name_type0', 1, 'Also Known As'),
('name', 'name_type0', 2, 'Birth Name'),
('name', 'name_type0', 3, 'Married Name'),
('note', 'format', 0, 'Unformatted'),
('note', 'format', 1, 'Preformatted'),
('person', 'gender', 0, 'Female'),
('person', 'gender', 1, 'Male'),
('person', 'gender', 2, 'Unknown'),
('place', 'the_type0', -1, 'Unknown'),
('place', 'the_type0', 0, 'Custom'),
('place', 'the_type0', 1, 'Country'),
('place', 'the_type0', 2, 'State'),
('place', 'the_type0', 3, 'County'),
('place', 'the_type0', 4, 'City'),
('place', 'the_type0', 5, 'Parish'),
('place', 'the_type0', 6, 'Locality'),
('place', 'the_type0', 7, 'Street'),
('place', 'the_type0', 8, 'Province'),
('place', 'the_type0', 9, 'Region'),
('place', 'the_type0', 10, 'Department'),
('place', 'the_type0', 11, 'Neighborhood'),
('place', 'the_type0', 12, 'District'),
('place', 'the_type0', 13, 'Borough'),
('place', 'the_type0', 14, 'Municipality'),
('place', 'the_type0', 15, 'Town'),
('place', 'the_type0', 16, 'Village'),
('place', 'the_type0', 17, 'Hamlet'),
('place', 'the_type0', 18, 'Farm'),
('place', 'the_type0', 18, 'Building'),
('place', 'the_type0', 20, 'Number')
;
-- for citation levels, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/citation.py#L74
-- for date properties, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/date.py#L584
-- for event types, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/eventtype.py#L101
-- for event reference roles see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/eventroletype.py#L45
-- for family types, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/familyreltype.py
-- for name types, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/nametype.py#L45
-- for place types, see: https://github.com/gramps-project/gramps/blob/master/gramps/gen/lib/placetype.py#L45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment