* [BUG] ob-sql sql-connection-alist
@ 2023-01-15 16:00 Andreas Gerler
2023-01-16 10:25 ` Daniel Kraus
2023-01-16 10:33 ` Ihor Radchenko
0 siblings, 2 replies; 18+ messages in thread
From: Andreas Gerler @ 2023-01-15 16:00 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 713 bytes --]
HI!
Last week I heard about using ob-sql with credentials stored in the variable used by isql.
However I had to modify ob-sql to get it actually working.
Can somebody test the pach before I send in a commit?
#+begin_src sql :engine mysql :dbconnection testdb
show tables;
#+end_src
(setq sql-connection-alist
'((testdb (sql-product 'mysql)
(sql-server "127.0.0.1")
(sql-user "mysql”)
(sql-port 3306)
(sql-password “foo")
(sql-database "mysql"))))
I was considering writing another patch to map the sql-product to engine.
That way we could get rid of another parameter in the src block.
Opinions?
[-- Attachment #1.2: ob-sql.el.diff --]
[-- Type: application/octet-stream, Size: 882 bytes --]
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 39a4573a5..92a157085 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -1,6 +1,6 @@
;;; ob-sql.el --- Babel Functions for SQL -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2023 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2022 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Maintainer: Daniel Kraus <daniel@kraus.my>
@@ -234,7 +234,7 @@ database connections."
(:database . sql-database)))
(mapped-name (cdr (assq name name-mapping))))
(cadr (assq mapped-name
- (cdr (assoc dbconnection sql-connection-alist))))))))
+ (cdr (assoc-string dbconnection sql-connection-alist t))))))))
(defun org-babel-execute:sql (body params)
"Execute a block of Sql code with Babel.
[-- Attachment #1.3: Type: text/plain, Size: 102 bytes --]
Thanks in advance…
Andreas Gerler
—
http://www.bundesbrandschatzamt.de/~baron
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-15 16:00 [BUG] ob-sql sql-connection-alist Andreas Gerler
@ 2023-01-16 10:25 ` Daniel Kraus
2023-01-20 17:24 ` Andreas Gerler
2023-01-16 10:33 ` Ihor Radchenko
1 sibling, 1 reply; 18+ messages in thread
From: Daniel Kraus @ 2023-01-16 10:25 UTC (permalink / raw)
To: Andreas Gerler; +Cc: emacs-orgmode
Hi!
Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
> Last week I heard about using ob-sql with credentials stored in the variable used by isql.
> However I had to modify ob-sql to get it actually working.
> Can somebody test the pach before I send in a commit?
>
> #+begin_src sql :engine mysql :dbconnection testdb
> show tables;
> #+end_src
I actually use this feature daily.
You have to quote the dbconnection. So this works currently:
> #+begin_src sql :engine mysql :dbconnection 'testdb
but I would agree that not needing the quote makes sense.
And since `assoc-string` works with symbol and string (i.e. it's backwards compatible)
I would install the patch if you send it.
> I was considering writing another patch to map the sql-product to engine.
> That way we could get rid of another parameter in the src block.
> Opinions?
I agree. Specifying :engine when it's already in the connection-alist is unnecessary.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-16 10:25 ` Daniel Kraus
@ 2023-01-20 17:24 ` Andreas Gerler
2023-01-20 17:30 ` Andreas Gerler
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Gerler @ 2023-01-20 17:24 UTC (permalink / raw)
To: Daniel Kraus; +Cc: emacs-orgmode
[-- Attachment #1.1: 0001-lisp-ob-eval.el-Display-error-fix.patch --]
[-- Type: application/octet-stream, Size: 1873 bytes --]
From db391f4123a62aa214741d6b1eb43b0a1e06f1b9 Mon Sep 17 00:00:00 2001
From: Andreas Gerler <baron@bundesbrandschatzamt.de>
Date: Sat, 7 Jan 2023 14:04:03 +0100
Subject: [PATCH] * lisp/ob-eval.el: Display error fix
* lisp/ob-eval.el: (org-babel-eval-error-notify): Display standard
error only if command exits non zero.
The problem is that sql connections might give warnings.
Now the information is available in the *Org-Babel Error* buffer
without displaying.
If you need always display toggle org-babel-eval-error-display-notify.
Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
---
lisp/ob-eval.el | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-eval.el b/lisp/ob-eval.el
index 6f6edb949..f4659fe96 100644
--- a/lisp/ob-eval.el
+++ b/lisp/ob-eval.el
@@ -36,6 +36,12 @@
(defvar org-babel-error-buffer-name "*Org-Babel Error Output*")
(declare-function org-babel-temp-file "ob-core" (prefix &optional suffix))
+(defcustom org-babel-eval-error-display-notify nil
+ "Display org-babel-eval-errors always or only if exit code is not 0."
+ :group 'org-babel
+ :version "29.1"
+ :type 'boolean)
+
(defun org-babel-eval-error-notify (exit-code stderr)
"Open a buffer to display STDERR and a message with the value of EXIT-CODE."
(let ((buf (get-buffer-create org-babel-error-buffer-name)))
@@ -45,7 +51,10 @@
(unless (bolp) (insert "\n"))
(insert stderr)
(insert (format "[ Babel evaluation exited with code %S ]" exit-code))))
- (display-buffer buf))
+ (when (or org-babel-eval-error-display-notify
+ (or (not (numberp exit-code))
+ (> exit-code 0)))
+ (display-buffer buf)))
(message "Babel evaluation exited with code %S" exit-code))
(defun org-babel-eval (command query)
--
2.39.0
[-- Attachment #1.2: Type: text/plain, Size: 1108 bytes --]
> On 16. Jan 2023, at 11:25, Daniel Kraus <daniel@kraus.my> wrote:
>
> Hi!
>
> Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
>
>> Last week I heard about using ob-sql with credentials stored in the variable used by isql.
>> However I had to modify ob-sql to get it actually working.
>> Can somebody test the pach before I send in a commit?
>>
>> #+begin_src sql :engine mysql :dbconnection testdb
>> show tables;
>> #+end_src
>
> I actually use this feature daily.
> You have to quote the dbconnection. So this works currently:
>
>> #+begin_src sql :engine mysql :dbconnection 'testdb
>
> but I would agree that not needing the quote makes sense.
> And since `assoc-string` works with symbol and string (i.e. it's backwards compatible)
> I would install the patch if you send it.
>
>> I was considering writing another patch to map the sql-product to engine.
>> That way we could get rid of another parameter in the src block.
>> Opinions?
>
> I agree. Specifying :engine when it's already in the connection-alist is unnecessary.
>
> Thanks,
> Daniel
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-20 17:24 ` Andreas Gerler
@ 2023-01-20 17:30 ` Andreas Gerler
2023-01-20 20:41 ` Daniel Kraus
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Gerler @ 2023-01-20 17:30 UTC (permalink / raw)
To: Daniel Kraus; +Cc: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 34 bytes --]
Sorry. That was the wrong patch.
[-- Attachment #1.2: 0001-lisp-ob-sql.el-allow-string-in-sql-connection-alist.patch --]
[-- Type: application/octet-stream, Size: 998 bytes --]
From 12661647049bbadeff470c56d17fafc44cae6163 Mon Sep 17 00:00:00 2001
From: Andreas Gerler <baron@bundesbrandschatzamt.de>
Date: Fri, 20 Jan 2023 18:17:51 +0100
Subject: [PATCH] lisp/ob-sql.el: allow string in sql-connection-alist
Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
---
lisp/ob-sql.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 39a4573a5..f73e7003f 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -234,7 +234,7 @@ database connections."
(:database . sql-database)))
(mapped-name (cdr (assq name name-mapping))))
(cadr (assq mapped-name
- (cdr (assoc dbconnection sql-connection-alist))))))))
+ (cdr (assoc-string dbconnection sql-connection-alist t))))))))
(defun org-babel-execute:sql (body params)
"Execute a block of Sql code with Babel.
--
2.39.0
[-- Attachment #1.3: Type: text/plain, Size: 1284 bytes --]
> On 20. Jan 2023, at 18:24, Andreas Gerler <baron@bundesbrandschatzamt.de> wrote:
>
> <0001-lisp-ob-eval.el-Display-error-fix.patch>
>
>> On 16. Jan 2023, at 11:25, Daniel Kraus <daniel@kraus.my> wrote:
>>
>> Hi!
>>
>> Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
>>
>>> Last week I heard about using ob-sql with credentials stored in the variable used by isql.
>>> However I had to modify ob-sql to get it actually working.
>>> Can somebody test the pach before I send in a commit?
>>>
>>> #+begin_src sql :engine mysql :dbconnection testdb
>>> show tables;
>>> #+end_src
>>
>> I actually use this feature daily.
>> You have to quote the dbconnection. So this works currently:
>>
>>> #+begin_src sql :engine mysql :dbconnection 'testdb
>>
>> but I would agree that not needing the quote makes sense.
>> And since `assoc-string` works with symbol and string (i.e. it's backwards compatible)
>> I would install the patch if you send it.
>>
>>> I was considering writing another patch to map the sql-product to engine.
>>> That way we could get rid of another parameter in the src block.
>>> Opinions?
>>
>> I agree. Specifying :engine when it's already in the connection-alist is unnecessary.
>>
>> Thanks,
>> Daniel
>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-20 17:30 ` Andreas Gerler
@ 2023-01-20 20:41 ` Daniel Kraus
2023-01-20 21:03 ` Andreas Gerler
2023-01-21 8:48 ` Ihor Radchenko
0 siblings, 2 replies; 18+ messages in thread
From: Daniel Kraus @ 2023-01-20 20:41 UTC (permalink / raw)
To: Andreas Gerler; +Cc: Ihor Radchenko, emacs-orgmode
Thanks.
@Ihor, since this is the first patch I install from another contributor,
is there anything I should look out for?
E.g. does this need a TINYCHANGE entry or something?
Or do you have already copyright assignments filled out, Andreas and
then it's not necessary?
Can I see somewhere who I need to ask for copyright assignments or not?
Thanks,
Daniel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-20 20:41 ` Daniel Kraus
@ 2023-01-20 21:03 ` Andreas Gerler
2023-01-21 8:48 ` Ihor Radchenko
1 sibling, 0 replies; 18+ messages in thread
From: Andreas Gerler @ 2023-01-20 21:03 UTC (permalink / raw)
To: Daniel Kraus; +Cc: Ihor Radchenko, emacs-orgmode
Hi Daniel,
I already contributed to Orgmode a few years ago for Vertica support and filled the copyright assignment back then.
Andreas
> On Jan 20, 2023, at 9:47 PM, Daniel Kraus <daniel@kraus.my> wrote:
>
> Thanks.
>
> @Ihor, since this is the first patch I install from another contributor,
> is there anything I should look out for?
>
> E.g. does this need a TINYCHANGE entry or something?
> Or do you have already copyright assignments filled out, Andreas and
> then it's not necessary?
> Can I see somewhere who I need to ask for copyright assignments or not?
>
> Thanks,
> Daniel
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-20 20:41 ` Daniel Kraus
2023-01-20 21:03 ` Andreas Gerler
@ 2023-01-21 8:48 ` Ihor Radchenko
2023-01-21 12:15 ` Andreas Gerler
` (2 more replies)
1 sibling, 3 replies; 18+ messages in thread
From: Ihor Radchenko @ 2023-01-21 8:48 UTC (permalink / raw)
To: Daniel Kraus, Bastien; +Cc: Andreas Gerler, emacs-orgmode
Daniel Kraus <daniel@kraus.my> writes:
> @Ihor, since this is the first patch I install from another contributor,
> is there anything I should look out for?
> E.g. does this need a TINYCHANGE entry or something?
1. General checks for tests passing and sanity of the patches
2. Ensuring copyright status, when total contributed nuber of LOC is
around 15
See https://orgmode.org/worg/org-maintenance.html and
https://www.gnu.org/prep/maintain/
Also, make sure that you are familiar with general contribution
guidelines listed at https://orgmode.org/worg/org-contribute.html
> Or do you have already copyright assignments filled out, Andreas and
> then it's not necessary?
> Can I see somewhere who I need to ask for copyright assignments or not?
We list all (well, most of) the past contributors and their copyright
assignment status at https://orgmode.org/worg/contributors.html
I also have a small hook for my Emacs mail client that automatically
checks the contributor status and number of contributed LOCs for Org
mailing list:
https://github.com/yantar92/emacs-config/blob/master/config.org#detect-fsf-contribution-status-of-sender-for-org-ml
Bastien has access to official FSF records. We need to ask him when
copyright assignment status cannot be determined from the Org
contributors page.
In this case, Andreas is not listed on
https://orgmode.org/worg/contributors.html
I also cannot find anything relevant in the mailing list archives.
(well, there is
https://orgmode.org/list/B664B5E8-B6A8-4B20-B0CB-F6149C720718@bundesbrandschatzamt.de,
but I do not see any confirmation of the copyright assignment status).
Bastien, could you please confirm the copyright status of Andreas Gerler?
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-21 8:48 ` Ihor Radchenko
@ 2023-01-21 12:15 ` Andreas Gerler
2023-01-22 10:58 ` Bastien Guerry
2023-01-26 10:44 ` Bastien Guerry
2 siblings, 0 replies; 18+ messages in thread
From: Andreas Gerler @ 2023-01-21 12:15 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Daniel Kraus, Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]
The copyright assignment was in April 2017.
gnu.org #1203873 if that helps.
> On 21. Jan 2023, at 09:48, Ihor Radchenko <yantar92@posteo.net> wrote:
>
> Daniel Kraus <daniel@kraus.my> writes:
>
>> @Ihor, since this is the first patch I install from another contributor,
>> is there anything I should look out for?
>
>> E.g. does this need a TINYCHANGE entry or something?
>
> 1. General checks for tests passing and sanity of the patches
> 2. Ensuring copyright status, when total contributed nuber of LOC is
> around 15
>
> See https://orgmode.org/worg/org-maintenance.html and
> https://www.gnu.org/prep/maintain/
>
> Also, make sure that you are familiar with general contribution
> guidelines listed at https://orgmode.org/worg/org-contribute.html
>
>> Or do you have already copyright assignments filled out, Andreas and
>> then it's not necessary?
>> Can I see somewhere who I need to ask for copyright assignments or not?
>
> We list all (well, most of) the past contributors and their copyright
> assignment status at https://orgmode.org/worg/contributors.html
>
> I also have a small hook for my Emacs mail client that automatically
> checks the contributor status and number of contributed LOCs for Org
> mailing list:
> https://github.com/yantar92/emacs-config/blob/master/config.org#detect-fsf-contribution-status-of-sender-for-org-ml
>
> Bastien has access to official FSF records. We need to ask him when
> copyright assignment status cannot be determined from the Org
> contributors page.
>
> In this case, Andreas is not listed on
> https://orgmode.org/worg/contributors.html
> I also cannot find anything relevant in the mailing list archives.
> (well, there is
> https://orgmode.org/list/B664B5E8-B6A8-4B20-B0CB-F6149C720718@bundesbrandschatzamt.de,
> but I do not see any confirmation of the copyright assignment status).
>
> Bastien, could you please confirm the copyright status of Andreas Gerler?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
so long…
Andreas Gerler
—
http://www.bundesbrandschatzamt.de/~baron
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-21 8:48 ` Ihor Radchenko
2023-01-21 12:15 ` Andreas Gerler
@ 2023-01-22 10:58 ` Bastien Guerry
2023-01-26 10:44 ` Bastien Guerry
2 siblings, 0 replies; 18+ messages in thread
From: Bastien Guerry @ 2023-01-22 10:58 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Daniel Kraus, Andreas Gerler, emacs-orgmode
Hi,
Ihor Radchenko <yantar92@posteo.net> writes:
> Bastien, could you please confirm the copyright status of Andreas
> Gerler?
I cannot find any entry with "Gerler" as a name, or with the email
"baron@bundesbrandschatzamt.de".
Andreas, can you write me in private with a copy of the signed FSF
copyright assignment? We can sort this out with the FSF copyright
clerk.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-21 8:48 ` Ihor Radchenko
2023-01-21 12:15 ` Andreas Gerler
2023-01-22 10:58 ` Bastien Guerry
@ 2023-01-26 10:44 ` Bastien Guerry
2023-01-27 13:13 ` Ihor Radchenko
2023-01-27 13:18 ` Ihor Radchenko
2 siblings, 2 replies; 18+ messages in thread
From: Bastien Guerry @ 2023-01-26 10:44 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Daniel Kraus, Andreas Gerler, emacs-orgmode
Hi,
Ihor Radchenko <yantar92@posteo.net> writes:
> Bastien, could you please confirm the copyright status of Andreas
> Gerler?
It was missing in the FSF copyright.list file, but it has been fixed
and Andreas can be added as a regular contributor.
Best,
--
Bastien
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-26 10:44 ` Bastien Guerry
@ 2023-01-27 13:13 ` Ihor Radchenko
2023-01-27 13:18 ` Ihor Radchenko
1 sibling, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2023-01-27 13:13 UTC (permalink / raw)
To: Bastien Guerry; +Cc: Daniel Kraus, Andreas Gerler, emacs-orgmode
Bastien Guerry <bzg@gnu.org> writes:
>> Bastien, could you please confirm the copyright status of Andreas
>> Gerler?
>
> It was missing in the FSF copyright.list file, but it has been fixed
> and Andreas can be added as a regular contributor.
Daniel, there is thus no obstacle installing the patch. And no need to
add TINYCHANGE cookie.
Note, however, that the commit message lacks changelog entry. We may
either ask Andreas to add it or you can do it manually, install the
patch, and take note about the amendment in the email thread (see my
other email replies).
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-26 10:44 ` Bastien Guerry
2023-01-27 13:13 ` Ihor Radchenko
@ 2023-01-27 13:18 ` Ihor Radchenko
2023-01-27 16:58 ` Andreas Gerler
1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2023-01-27 13:18 UTC (permalink / raw)
To: Bastien Guerry; +Cc: Daniel Kraus, Andreas Gerler, emacs-orgmode
Bastien Guerry <bzg@gnu.org> writes:
> It was missing in the FSF copyright.list file, but it has been fixed
> and Andreas can be added as a regular contributor.
Done.
https://git.sr.ht/~bzg/worg/commit/3dbeb2db
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-27 13:18 ` Ihor Radchenko
@ 2023-01-27 16:58 ` Andreas Gerler
2023-01-28 14:13 ` Andreas Gerler
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Gerler @ 2023-01-27 16:58 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Bastien Guerry, Daniel Kraus, emacs-orgmode
Hi!
I can prepare a new commit this weekend.
so long...
Andreas
> On Jan 27, 2023, at 2:18 PM, Ihor Radchenko <yantar92@posteo.net> wrote:
>
> Bastien Guerry <bzg@gnu.org> writes:
>
>> It was missing in the FSF copyright.list file, but it has been fixed
>> and Andreas can be added as a regular contributor.
>
> Done.
> https://git.sr.ht/~bzg/worg/commit/3dbeb2db
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-27 16:58 ` Andreas Gerler
@ 2023-01-28 14:13 ` Andreas Gerler
2023-01-30 16:59 ` Daniel Kraus
0 siblings, 1 reply; 18+ messages in thread
From: Andreas Gerler @ 2023-01-28 14:13 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 43 bytes --]
Hi!
I added the missing changelog entry.
[-- Attachment #1.2: 0001-lisp-ob-sql.el-allow-string-in-sql-connection-alist.patch --]
[-- Type: application/octet-stream, Size: 1125 bytes --]
From 37c4d1779ca2a426610bb61cb3a15f85775fa916 Mon Sep 17 00:00:00 2001
From: Andreas Gerler <baron@bundesbrandschatzamt.de>
Date: Fri, 20 Jan 2023 18:17:51 +0100
Subject: [PATCH 1/2] lisp/ob-sql.el: allow string in sql-connection-alist
* ob-sql.el (org-babel-find-db-connection-param): read
sql-connection-alist like sql.el/sql-connect and allow strings.
Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
---
lisp/ob-sql.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 39a4573a5..f73e7003f 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -234,7 +234,7 @@ database connections."
(:database . sql-database)))
(mapped-name (cdr (assq name name-mapping))))
(cadr (assq mapped-name
- (cdr (assoc dbconnection sql-connection-alist))))))))
+ (cdr (assoc-string dbconnection sql-connection-alist t))))))))
(defun org-babel-execute:sql (body params)
"Execute a block of Sql code with Babel.
--
2.39.0
[-- Attachment #1.3: Type: text/plain, Size: 239 bytes --]
> On 27. Jan 2023, at 17:58, Andreas Gerler <baron@bundesbrandschatzamt.de> wrote:
>
> Hi!
>
> I can prepare a new commit this weekend.
>
so long…
Andreas Gerler
—
http://www.bundesbrandschatzamt.de/~baron
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 874 bytes --]
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-15 16:00 [BUG] ob-sql sql-connection-alist Andreas Gerler
2023-01-16 10:25 ` Daniel Kraus
@ 2023-01-16 10:33 ` Ihor Radchenko
2023-01-16 10:45 ` Daniel Kraus
1 sibling, 1 reply; 18+ messages in thread
From: Ihor Radchenko @ 2023-01-16 10:33 UTC (permalink / raw)
To: Andreas Gerler; +Cc: emacs-orgmode
Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
> Last week I heard about using ob-sql with credentials stored in the variable used by isql.
> However I had to modify ob-sql to get it actually working.
> Can somebody test the pach before I send in a commit?
>
> #+begin_src sql :engine mysql :dbconnection testdb
> show tables;
> #+end_src
>
> (setq sql-connection-alist
> '((testdb (sql-product 'mysql)
> (sql-server "127.0.0.1")
> (sql-user "mysql”)
> (sql-port 3306)
> (sql-password “foo")
> (sql-database "mysql"))))
I am looking at the docstring of `sql-connection-alist':
An alist of connection parameters for interacting with a SQL product.
Each element of the alist is as follows:
(CONNECTION \(SQL-VARIABLE VALUE) ...)
Where CONNECTION is a case-insensitive string identifying the
connection, ...
So, your "setq" example is incorrect: must use "testdb" instead of
`testdb' symbol.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-16 10:33 ` Ihor Radchenko
@ 2023-01-16 10:45 ` Daniel Kraus
2023-01-16 11:05 ` Ihor Radchenko
0 siblings, 1 reply; 18+ messages in thread
From: Daniel Kraus @ 2023-01-16 10:45 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Andreas Gerler, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
> Andreas Gerler <baron@bundesbrandschatzamt.de> writes:
>> (setq sql-connection-alist
>> '((testdb (sql-product 'mysql)
>> (sql-server "127.0.0.1")
>> (sql-user "mysql”)
>> (sql-port 3306)
>> (sql-password “foo")
>> (sql-database "mysql"))))
>
> I am looking at the docstring of `sql-connection-alist':
>
> An alist of connection parameters for interacting with a SQL product.
> Each element of the alist is as follows:
>
> (CONNECTION \(SQL-VARIABLE VALUE) ...)
>
> Where CONNECTION is a case-insensitive string identifying the
> connection, ...
>
> So, your "setq" example is incorrect: must use "testdb" instead of
> `testdb' symbol.
I'm not sure why but I also have the connection as a symbol in my
`sql-connection-alist`.
Looking in `sql.el` `(sql-connect)`, they also use
`assoc-string` to receive the connection:
https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/sql.el?h=ac2a6fc83fac6390892b068a830ebe0f22364e05#n4398
So I think that change is good and supports both formats
(same as `sql-connect`).
Cheers,
Daniel
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [BUG] ob-sql sql-connection-alist
2023-01-16 10:45 ` Daniel Kraus
@ 2023-01-16 11:05 ` Ihor Radchenko
0 siblings, 0 replies; 18+ messages in thread
From: Ihor Radchenko @ 2023-01-16 11:05 UTC (permalink / raw)
To: Daniel Kraus; +Cc: Andreas Gerler, emacs-orgmode
Daniel Kraus <daniel@kraus.my> writes:
>> I am looking at the docstring of `sql-connection-alist':
>>
>> An alist of connection parameters for interacting with a SQL product.
>> Each element of the alist is as follows:
>>
>> (CONNECTION \(SQL-VARIABLE VALUE) ...)
>>
>> Where CONNECTION is a case-insensitive string identifying the
>> connection, ...
>>
>> So, your "setq" example is incorrect: must use "testdb" instead of
>> `testdb' symbol.
>
> I'm not sure why but I also have the connection as a symbol in my
> `sql-connection-alist`.
> Looking in `sql.el` `(sql-connect)`, they also use
> `assoc-string` to receive the connection:
> https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/sql.el?h=ac2a6fc83fac6390892b068a830ebe0f22364e05#n4398
>
> So I think that change is good and supports both formats
> (same as `sql-connect`).
Agree. In fact, I missed "insensitive" part of the docstring, reading it
opposite.
Andreas, feel free to send a proper patch with commit message. But
please do not decrease the copyright years :)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2023-01-30 17:04 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-15 16:00 [BUG] ob-sql sql-connection-alist Andreas Gerler
2023-01-16 10:25 ` Daniel Kraus
2023-01-20 17:24 ` Andreas Gerler
2023-01-20 17:30 ` Andreas Gerler
2023-01-20 20:41 ` Daniel Kraus
2023-01-20 21:03 ` Andreas Gerler
2023-01-21 8:48 ` Ihor Radchenko
2023-01-21 12:15 ` Andreas Gerler
2023-01-22 10:58 ` Bastien Guerry
2023-01-26 10:44 ` Bastien Guerry
2023-01-27 13:13 ` Ihor Radchenko
2023-01-27 13:18 ` Ihor Radchenko
2023-01-27 16:58 ` Andreas Gerler
2023-01-28 14:13 ` Andreas Gerler
2023-01-30 16:59 ` Daniel Kraus
2023-01-16 10:33 ` Ihor Radchenko
2023-01-16 10:45 ` Daniel Kraus
2023-01-16 11:05 ` Ihor Radchenko
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.