# How can I connect to the DB?

**URL:** <https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155>\
**Category:** Help\
**Created:** [January 9, 2023, 10:56am UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155 "2023-01-09T10:56:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Urchello](https://avatars.discourse-cdn.com/v4/letter/u/c4cdca/32.png) [@Urchello](https://gramps.discourse.group/u/Urchello)\
**Post date:** [January 9, 2023, 10:56am UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/1 "2023-01-09T10:56:03Z")

</div>

Is it possible to connect to the local Gramps database and execute manual some sql-queries to get some specific data? Or maybe sometimes make group-updatings by substring via **like**.  
I’m on Windows 10. Can install all needed software.

Could you pls describe how to make connection or maybe you already have an instruction. Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Mattkmmr](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/mattkmmr/32/410_2.png) [@Mattkmmr](https://gramps.discourse.group/u/Mattkmmr)\
**Post date:** [January 9, 2023, 11:17am UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/2 "2023-01-09T11:17:19Z")

</div>

You can connect to Gramps database with other tools, but most data is stored as pickled data blobs and is not accessible with SQL queries.

There is an addon (SQLite Export) which also exports pickled data into sqlite tables.

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [January 9, 2023, 2:35pm UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/3 "2023-01-09T14:35:28Z")

</div>

> [@Mattkmmr](#):
>
> but most data is stored as pickled data blobs and is not accessible with SQL queries.

There is a note in wiki for the early SQLite development: it says that parallel unpickled data is also stored for query performance reasons. (And probably as an experiment in moving away from pickled blobs.) That reads like: “you can use the parallel tables for queries but not writes.”

I wonder if that is accurate & where more information can be found.

---

<div class="post-metadata">

**Author:** ![Mattkmmr](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/mattkmmr/32/410_2.png) [@Mattkmmr](https://gramps.discourse.group/u/Mattkmmr)\
**Post date:** [January 9, 2023, 4:31pm UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/4 "2023-01-09T16:31:16Z")

</div>

> [@emyoulation](#):
>
> There is a note in wiki for the early SQLite development: it says that parallel unpickled data is also stored for query performance reasons.

Yes some data is duplicated e.g. for persons there are the first name and last name fields of the primary name and gender, but all other data is stored in the data blobs.

You can download and use [sqlitebrowser](https://sqlitebrowser.org/) to open your Gramps database (or a copy) and view the data/structure and compare it to the SQLite export addons database export.

---

<div class="post-metadata">

**Author:** ![Urchello](https://avatars.discourse-cdn.com/v4/letter/u/c4cdca/32.png) [@Urchello](https://gramps.discourse.group/u/Urchello)\
**Post date:** [January 9, 2023, 8:33pm UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/5 "2023-01-09T20:33:48Z")

</div>

Really @Mattkmmr . I’ve open the original DB. Almost all data are under BLOB. And then made sql-export and opened it - the DB has much more readable data. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [February 8, 2023, 8:33pm UTC](https://gramps.discourse.group/t/how-can-i-connect-to-the-db/3155/6 "2023-02-08T20:33:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
