ndwarshuis / org-sql Goto Github PK
View Code? Open in Web Editor NEWSQL backend for Emacs Org-Mode
License: GNU General Public License v3.0
SQL backend for Emacs Org-Mode
License: GNU General Public License v3.0
Hi,
I found this package today through https://github.com/l3kn/org-zettelkasten, which I also stumbled upon today. A couple of years ago I was working on a branch of helm-org-rifle
that indexes Org files in SQLite, also inspired by John Kitchin's work, but I haven't touched it in a while. Since then I've worked on org-ql
, and one of the long-term ideas I have for it is to have an indexed backend, especially for Org files that aren't open in Emacs. So it would be interesting if this package could be a part of that.
So, if I may, what are your long-term plans for this package?
Thanks.
Some of links are defined with the abbreviation.
The link abbreviation is not present in the table links
only the original link type.
For example
* link defined as abbreviation
- [[wikipedia:Statistical_distance]]
which is defined in the org-link-abbrev-list
as:
'("wikipedia" . "https://en.wikipedia.org/wiki/%s")
is stored without the abbreviation:
Not important. Just nice to have there a new column with the abbreviation as well.
Use case: I use the abbreviation as a kind of metadata, e.g. for the same page I use more abbreviation (wiki_note, wiki_ref, wiki_quote).
#17 describes the way I get here.
I installed it, it worked the first time and hasn't worked since.
Even the files table is not being populated with the list of org files.
I have done (org-sql-user-reset)
and (org-sql-user-update)
a number of times and there is still no response.
Is there some way to configure org-sql
and some of the underlying sub systems to print some debugging messages as to what is happening behind the scenes?
Hmm, I don't see any effort
values in the headlines
table; they're all NULL
.
Trivial test file:
* Test
:PROPERTIES:
:Effort: 1h
:END:
Result after running M-x org-sql-user-update
:
sqlite> select headline_text, effort from headlines;
Test|
(I've configured only org-sql-files
and org-sql-db-config
to be the input org-mode file and the output sqlite file, respectively; no other changes to org-sql
variables. Emacs 27.1 on Mac.)
I like this idea! really great. Can it provide to view data in web with a simple local server and simple web dashboard page? Emacs has already local web server support with package like elnode
, web-server
, simple-httped
etc. WDYT?
Emacs 27.1, Org-mode 9.4, Org-sql 1.02
I run into this error when I tried to use org-sql in Termux (Android Terminal emulator). It doesn't have the standard file hierarchy due to limitations in Android.
The error origin seems to be here (defconst org-sql--sqlite-exe "/usr/bin/sqlite3")
A slightly better solution would be to check the existence of executable in the PATH. I see you are aware of this, you have TODO mentioning Windows there.
PS: I quite enjoy using your package for last several months, thanks.
PS: I may pull something to solve it, it sounds like a good starter issue for someone who doesn't have experience with Elisp (me).
Hi, I use custom link types, examples are below.
These links are not stored in the links
table. It would be nice to have them there as well.
* custom link types
[[wikipedia:Statistical_distance]]
[[google:Validating Causal Model]]
[[ticker:intel]]
I've updated org-sql from version 1.01 to 1.1 and the following error appears when I try to update the database (sqlite database).
Symbol’s function definition is void: org-ml-headline-get-logbook
What I tried to solve it:
org-sql-files
) -> OKSo it seems to me, that some of my org-mode files, which were parsed successfully in the previous version, are source of the error in the new version.
I have dozens of org-mode files. Do you have an idea what should I look for?
Thanks for your great package.
I freshly installed it and called org-sql-user-reset
. It gave me this error message.
No prompt found or ‘comint-prompt-regexp’ not set properly
.
System: Windows 10, Emacs 26.1
The command org-sql-user-push calls org-sql-pull-from-db and vice versa.
Lines 3738 to 3750 in 2487d89
Hi
Thanks for your package. It's really well done and works like a charm!
I configured a cron job with 0 0 * * * emacs --script ~/.emacs.d/stalk-yourself.el
In the salk-yourself.el-Script straight is bootstraped, org-sql configured and (org-sql-push-to-db)
called.
Now after two days when running top
I see multiple postgres-processes.
Shouldn't a delete-process in org-sql--run-command be called to close these postgres-processes?
Best regards
lordnik22
Thank you for a good project. I am not sure whether the .el is capturing clocking data. I can see data in healines and timestamps tables but cloking tables is empty. my .org file is as below. I do not get any error message when I do M-x org-sql-user-update . Please let me know if you need more information. Thank you.
Hello,
I'm trying to get org-sql running but have been scratching my head for the past hours over unusual behaviour:
Configuration seems ok (macOs, Catalina), creating a db worked. As I'm not really experienced in emacs (i.e. lisp), I'm not sure if I configured it ok. I've installed it from Melpa and this is what I have in the config file:
(use-package org-sql :ensure t ;; add config options here... :config (setq org-sql-files '("~/org/inbox.org")) )
Any ideas?
The value org-sqlite-db-path
mentioned at https://github.com/ndwarshuis/org-sql#general-behavior should be org-sql-sqlite-path
.
org-sqlite-db-path
cannot be found in a search of the code.
org-sql.el
uses the function f-write
, but doesn't have (require 'f)
.
Thanks for making such a wonderful tool! I really like the pushing functionality.
For pulling, it fails because s-matches-p
expects a string but gets a nil
instead.
;; error
Pulling data from Org SQL database
s-matches-p: Wrong type argument: stringp, nil
This should be reproducible on emacs 27.2 and with the org file having the following content
* a
123
On emacs 27.2 and the lastest commit, calling (org-sql-user-push)
on the org file with content
* a
123
returns the error
Debugger entered--Lisp error: (error "Error: in prepare, no such table: file_metadata (1)\n")
signal(error ("Error: in prepare, no such table: file_metadata (1)\n"))
error("Error: in prepare, no such table: file_metadata (1)\n")
(if (= 0 rc) (progn (mapcar #'(lambda (it) (ignore it) (let ((input0 it)) (let* ((h (plist-get input0 :outline_hash)) (p (plist-get input0 :file_path))) (cons h p)))) (org-sql--parse-output-to-plist org-sql-db-config cols (s-trim it-out)))) (error it-out))
(let* ((--dash-source-211-- input0) (rc (car-safe (prog1 --dash-source-211-- (setq --dash-source-211-- (cdr --dash-source-211--))))) (it-out --dash-source-211--)) (if (= 0 rc) (progn (mapcar #'(lambda (it) (ignore it) (let ((input0 it)) (let* ((h (plist-get input0 :outline_hash)) (p (plist-get input0 :file_path))) (cons h p)))) (org-sql--parse-output-to-plist org-sql-db-config cols (s-trim it-out)))) (error it-out)))
(let ((input0 (org-sql-send-sql cmd))) (let* ((--dash-source-211-- input0) (rc (car-safe (prog1 --dash-source-211-- (setq --dash-source-211-- (cdr --dash-source-211--))))) (it-out --dash-source-211--)) (if (= 0 rc) (progn (mapcar #'(lambda (it) (ignore it) (let ((input0 it)) (let* ((h (plist-get input0 :outline_hash)) (p (plist-get input0 :file_path))) (cons h p)))) (org-sql--parse-output-to-plist org-sql-db-config cols (s-trim it-out)))) (error it-out))))
(let* ((tbl-name 'file_metadata) (cols '(:file_path :outline_hash)) (cmd (org-sql--format-select-statement org-sql-db-config cols tbl-name))) (let ((input0 (org-sql-send-sql cmd))) (let* ((--dash-source-211-- input0) (rc (car-safe (prog1 --dash-source-211-- (setq --dash-source-211-- (cdr --dash-source-211--))))) (it-out --dash-source-211--)) (if (= 0 rc) (progn (mapcar #'(lambda (it) (ignore it) (let ((input0 it)) (let* ((h (plist-get input0 :outline_hash)) (p (plist-get input0 :file_path))) (cons h p)))) (org-sql--parse-output-to-plist org-sql-db-config cols (s-trim it-out)))) (error it-out)))))
org-sql--db-get-hashpathpairs()
(let* ((disk-hashpathpairs (org-sql--disk-get-hashpathpairs)) (db-hashpathpairs (org-sql--db-get-hashpathpairs)) (max-ids (org-sql--get-max-ids)) (--dash-source-220-- (org-sql--partition-hashpathpairs disk-hashpathpairs db-hashpathpairs)) (fi (cdr (assoc 'files-to-insert --dash-source-220--))) (fd (cdr (assoc 'files-to-delete --dash-source-220--))) (pi (cdr (assoc 'paths-to-insert --dash-source-220--))) (pd (cdr (assoc 'paths-to-delete --dash-source-220--))) (pi* (mapcar #'(lambda (it) (ignore it) (list :hash (car it) :path (cdr it) :attrs (file-attributes (cdr it)))) pi))) (list (org-sql--format-path-delete-statement org-sql-db-config pd) (org-sql--format-outline-delete-statement org-sql-db-config fd) (org-sql--format-insert-statements org-sql-db-config max-ids pi* (mapcar #'(lambda (it) (ignore it) (org-sql--hashpathpair-get-outline-config (car it) (cdr it))) (org-sql--group-hashpathpairs-by-hash fi)))))
org-sql--get-transactions()
(org-sql--send-transaction-with-hook nil org-sql-post-push-hooks (org-sql--get-transactions))
org-sql-push-to-db()
(let ((input0 (org-sql-push-to-db))) (let* ((--dash-source-250-- input0) (rc (car-safe (prog1 --dash-source-250-- (setq --dash-source-250-- (cdr --dash-source-250--))))) (it-out --dash-source-250--)) (if (= 0 rc) (progn (if org-sql-debug (progn (message "Debug output for %s" "org-sql-push-to-db") (message (if (equal it-out "") "Run Successfully" it-out)))) (message "%s completed" "org-sql-push-to-db")) (progn (message "%s failed" "org-sql-push-to-db") (if org-sql-debug (progn (message it-out)))))))
org-sql-user-push()
eval((org-sql-user-push) nil)
edebug-eval-defun(nil)
apply(edebug-eval-defun nil)
eval-defun(nil)
eros-eval-defun(nil)
#<subr funcall-interactively>(eros-eval-defun nil)
apply(#<subr funcall-interactively> (eros-eval-defun nil))
funcall-interactively(eros-eval-defun nil)
#<subr call-interactively>(eros-eval-defun nil nil)
apply(#<subr call-interactively> (eros-eval-defun nil nil))
explain-pause--wrap-call-interactively(#<subr call-interactively> eros-eval-defun nil nil)
apply(explain-pause--wrap-call-interactively #<subr call-interactively> (eros-eval-defun nil nil))
call-interactively(eros-eval-defun nil nil)
command-execute(eros-eval-defun)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.