d12frosted / vulpea

A collection of functions for note taking based on `org` and `org-roam`.
GNU General Public License v3.0
237 stars 12 forks source link

Error: EmacSQL had an unhandled condition: "no such table: meta" #102

Closed hyan46 closed 3 years ago

hyan46 commented 3 years ago

After updating the latest version of persist meta in database, it seems to create an error:

EmacSQL had an unhandled condition: "no such table: meta"

when I use any vulpea functions such as vulpea-find. I have tried the vulpea-db-setup as well but still not fix this problem.

d12frosted commented 3 years ago

You need to remove org-roam.db cache file and resync everything. I will think how to make it more seamless.

d12frosted commented 3 years ago

~Or wait for few mins I will push a fix so you can test it~

it's getting messier than I thought. So yeah, workaround for now is to remove org-roam.db file and rebuild the cache. You can achieve it via calling org-roam-db-sync with universal argument, or explicitly passing a 'force argument.

d12frosted commented 3 years ago

And if that also doesn't work (please let me know), use the following script:

(advice-add 'org-roam-db-autosync-enable :before #'vulpea-db-setup)
(org-roam-db-sync 'force)

Sorry for the issue, will try to fix it today and provide better installation instructions.

hyan46 commented 3 years ago

I have tried deleting the org-roam.db file and do the org-roam-db-sync again and it seems still show the error: "EmacSQL had an unhandled condition: "no such table: meta"". I tried again using the (org-roam-db-sync 'force) but seems still not working.

I am not sure if my setup file is correct. I have

(use-package! org-roam
;;  Some other custimization
  :config
  (vulpea-db-setup)
  (org-roam-db-autosync-enable)
 )

(use-package vulpea
  :hook (
         (before-save . vulpea-pre-save-hook)
         (org-roam-db-autosync-mode . vulpea-db-setup)
        )
;; some other customization
)

Related to the vulpea-db-setup.

d12frosted commented 3 years ago

Look, I pushed a potential fix.

You just need to follow installation instructions (where you hook into org-roam-autosync-hook). And then everything should work. Please let me know if that works.

It's not a real fix yet, but fortunately you will not need to change anything in your setup - I will just make things better under the hood.

d12frosted commented 3 years ago

@hyan46 thanks for checking, could you try again with the latest commit? :) Your setup looks good, just use latest commit of vulpea.

hyan46 commented 3 years ago

Thanks, I just tried the latest commit and removed the db files using org-roam-db-clear-all and rebuild it using org-roam-db-sync and it seems still showing the same error. Not sure if I correctly run the vulpea-db-setup or if there are any other issues.

d12frosted commented 3 years ago

Your setup is similar to the setup in tests. Are you sure you have the latest commit? You can check that in your straight cache (doom uses it under the hood). There is repos folder that should contain vulpea repository, so you can check there. And btw, if it's the latest version and it still doesn't work, you can reset to older commit that worked for you and send me a link to your dotfiles.

Cheers, @.***

On Thu, Aug 19, 2021 at 09:15, Hao Yan @.***> wrote:

Thanks, I just tried the latest commit and removed the db files using org-roam-db-clear-all and rebuild it using org-roam-db-sync and it seems still showing the same error. Not sure if I correctly run the vulpea-db-setup or if there are any other issues.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

hyan46 commented 3 years ago

I use doom emacs and checked it updated to the latest version using doom upgrade. Also, after rebuilding the database again and rebooting emacs, it seems to work right now! I will start exploring the use of the meta further, thanks!

d12frosted commented 3 years ago

Glad it works now. I have updated the approach of hooking into org-roam-db. Hope this works much better for other people upgrading or only starting to use vulpea. See 73165ca.

Also, I've updated README to include more information about metadata. See 156af70. Hope you find it useful @hyan46

anupam312nwd commented 2 years ago

Hi, I am getting a similar issue: EmacSQL had an unhandled condition: "no such table: notes". I tried

(advice-add 'org-roam-db-autosync-enable :before #'vulpea-db-setup)
(org-roam-db-sync 'force)

and deleted org-roam.db and rebuild it but it is still throwing that error.

d12frosted commented 2 years ago

@anupam312nwd What commit/version are you using? How do you install vulpea?

anupam312nwd commented 2 years ago

@d12frosted I am using vulpea 0.2.0 version. I am using doom emacs. I have following config:

(package! vulpea)  ;; in package.el
(after! vulpea
  (add-hook 'org-roam-db-autosync-mode #'vulpea-db-autosync-enable)
  )  ;; in config.el

It did start working fine once, but after running (org-roam-db-sync 'force), I started getting the error EmacSQL had an unhandled condition: "no such table: notes" again which persisted even after deleting org-roam.db, and restarting emacs.

d12frosted commented 2 years ago

🤔 In your case (add-hook 'org-roam-db-autosync-mode #'vulpea-db-autosync-enable) is executed too late I think. This hook must be added before loading org-roam as vulpea-db-autosync-mode configures org-roam-db. Don't worry, it doesn't trigger vulpea or org-roam loading. So can you please try converting (after! vulpea XXX) to XXX?

anupam312nwd commented 2 years ago

Thanks! Using

(use-package! vulpea
  :hook ((org-roam-db-autosync-mode . vulpea-db-autosync-enable)))

worked fine. It's also updating the backlinks simultaneously.

d12frosted commented 2 years ago

Glad to hear. And thanks for sharing the snippet. I will include it in the documentation.