# Sqlite now in Emacs distribution

**URL:** <https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271>\
**Category:** Development\
**Created:** [December 13, 2021, 4:01pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271 "2021-12-13T16:01:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcmkk3](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@jcmkk3](https://org-roam.discourse.group/u/jcmkk3)\
**Post date:** [December 13, 2021, 4:01pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/1 "2021-12-13T16:01:53Z")

</div>

Not sure if you all saw this, but thought you might be interested. Looks like sqlite got added (optionally) to the emacs distribution [emacs.git - Emacs source repository](http://git.savannah.gnu.org/cgit/emacs.git/commit/etc/NEWS?id=e5f71051a00a4ceb63cadc2513cb9619a1adffcc)

I know that there’s been some talk in the past about migrating some of the db related features to org proper, in order for them to be taken advantage of in more than just roam. Seems like this might make that more of a possibility. At the very least, it might be even easier/simpler to install org-roam in the future.

---

<div class="post-metadata">

**Author:** ![gcoladon](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/gcoladon/32/976_2.png) [@gcoladon](https://org-roam.discourse.group/u/gcoladon)\
**Post date:** [December 14, 2021, 4:03am UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/2 "2021-12-14T04:03:14Z")

</div>

> [@jcmkk3](#):
>
> Looks like sqlite got added (optionally) to the emacs distribution

Wow, I totally want to try this. Since it was added in the last week, is the only way to try this out to check out HEAD and build from source?

---

<div class="post-metadata">

**Author:** ![gcoladon](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/gcoladon/32/976_2.png) [@gcoladon](https://org-roam.discourse.group/u/gcoladon)\
**Post date:** [December 14, 2021, 3:39pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/3 "2021-12-14T15:39:20Z")

</div>

I was tempted to try just copying the lisp/sqllite-mode.el file into my local configuration, but I read in there that it depends on sqlite.c, which gave me the impression that wouldn’t work.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [December 14, 2021, 6:16pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/4 "2021-12-14T18:16:58Z")

</div>

`sqlite.c` has been added to the dev branch of Emacs (for version 29, not the upcoming 28), if I’m reading [this](https://git.savannah.gnu.org/cgit/emacs.git/tree/src/sqlite.c) correctly.

I can’t assess how useful it will be for Org-roam – the [foreign key switch](https://github.com/org-roam/org-roam/issues/1927#issuecomment-955165126) needs to be turned on somehow, perhaps in the source code (?)

---

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 27, 2023, 11:35am UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/5 "2023-03-27T11:35:36Z")

</div>

I build Emacs 29 (from git) myself. But it seems (based on `system-configuration-features`) that SQLITE3 is not part of it by default.

Do you know how I can switch it on via build or where should I look into the build system to get the switch myself?

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 27, 2023, 12:42pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/6 "2023-03-27T12:42:26Z")

</div>

What’s your OS?

As far as I see in [the source](https://git.savannah.gnu.org/cgit/emacs.git/tree/configure.ac?h=emacs-29#n458), and from my build on Ubuntu, the switch is on by default; below is what I did (from my log for December 2022)

```plaintext
    $ git clone https://git.savannah.gnu.org/git/emacs.git --branch emacs-29 --depth 1 emacs-29
    $ ./autogen.sh
    $ ./configure --with-native-compilation --with-tree-sitter --with-small-ja-dic
    $ make -j$(nproc)

```

If SQLITE is not part of your Emacs feature, you probably do not have the sqlite3 library. Again on Ubuntu:

```plaintext
sudo apt install libsqlite3-dev

```

Use function `sqlite-available-p` to check sqlite availability in your Emacs.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 27, 2023, 12:46pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/7 "2023-03-27T12:46:45Z")

</div>

In addition, when you have run `configure`, at the end it should display a summary. You should be able to see if you have the correct sqlite library so that `make` can build it with the feature.

---

<div class="post-metadata">

**Author:** ![buhtz](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@buhtz](https://org-roam.discourse.group/u/buhtz)\
**Post date:** [March 27, 2023, 1:33pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/8 "2023-03-27T13:33:49Z")

</div>

> probably do not have the sqlite3 library

Them it can not be “on by default” if ti depends on an installed libraray. The buld system need to take care of that.  
The state of the on/off switch shouldn’t depend on the available libraries installed. The system need to inform the user if a lib is missing in that case.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 27, 2023, 2:36pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/9 "2023-03-27T14:36:01Z")

</div>

I do not follow your argument but perhaps you can take it to Emacs development mailing list and see what they might say.

I don’t have any further comment on this matter from a perspective of an Org-roam and Emacs user.

---

<div class="post-metadata">

**Author:** ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)\
**Post date:** [March 27, 2023, 2:36pm UTC](https://org-roam.discourse.group/t/sqlite-now-in-emacs-distribution/2271/10 "2023-03-27T14:36:39Z")

</div>

> [@buhtz](#):
>
> The system need to inform the user if a lib is missing in that case.

Like I said, you get to see a summary and see this.
