emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Kraus <daniel@kraus.my>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [patch] ob-clojure: Fix results output
Date: Tue, 14 Mar 2023 14:38:24 +0100	[thread overview]
Message-ID: <873567h2kk.fsf@kraus.my> (raw)
In-Reply-To: <874jqno6hw.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

Hi!

Ihor Radchenko <yantar92@posteo.net> writes:

> Daniel Kraus <daniel@kraus.my> writes:
>
>> This was apparently a kludge that ob-clojure used to evaluate ClojureScript
>> in the normal clojure:execute function.
>> I simply used the same kludge where I need to check for cljs, but after
>> reviewing it's not really necessary and I removed the :target parameter
>> completely. As this was undocumented I guess it's ok to remove?!
>
> Yes, it is OK to remove what is undocumented. We may still announce the
> change though.

I added an entry to ORG-NEWS under Misc.

>>>> -(defun ob-clojure-eval-with-babashka (bb expanded)
>> I created an obsolete-function-alias.
>
> It should better go to org-compat.el.

Moved the alias to org-compat.
I wasn't sure where to put it exactly.
It's now in the ~Obsolete aliases~ page.

> What about the new customization `ob-clojure-cli-command'?

I added a news entry in ORG-NEWS.

>> +(defcustom ob-clojure-nbb-command (or (executable-find "nbb")
>> +                                      (when-let (npx (executable-find "npx"))
>> +                                        (concat npx " nbb")))
>>    "Path to the nbb executable."
>
> This is not a path anymore, when the value is "npx nbb".
> Can just use "Command to invoke nbb executable".

Fixed.


Attached is the new patch with the changes.


Thanks for your review and guidance,
  Daniel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ob-sql.el-Add-support-for-Athena.patch --]
[-- Type: text/x-patch, Size: 2150 bytes --]

From ddace051205d20b24c047962ca9d1335bdd90284 Mon Sep 17 00:00:00 2001
From: Daniel Kraus <daniel@kraus.my>
Date: Mon, 16 Jan 2023 11:35:02 +0100
Subject: [PATCH] lisp/ob-sql.el: Add support for Athena

* lisp/ob-sql.el (org-babel-execute:sql): Add support for Athena
---
 lisp/ob-sql.el | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 39a4573a5..640ecb2c0 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -53,14 +53,15 @@
 ;; - rowname-names
 ;;
 ;; Engines supported:
-;; - mysql
+;; - athena
 ;; - dbi
 ;; - mssql
-;; - sqsh
-;; - postgresql (postgres)
+;; - mysql
 ;; - oracle
-;; - vertica
+;; - postgresql (postgres)
 ;; - saphana
+;; - sqsh
+;; - vertica
 ;;
 ;; TODO:
 ;;
@@ -254,6 +255,11 @@ This function is called by `org-babel-execute-src-block'."
                        (org-babel-temp-file "sql-out-")))
 	 (header-delim "")
          (command (cl-case (intern engine)
+                    (athena (format "athenacli %s -e %s %s > %s"
+			            (or cmdline "")
+			            (org-babel-process-file-name in-file)
+                                    database
+			            (org-babel-process-file-name out-file)))
                     (dbi (format "dbish --batch %s < %s | sed '%s' > %s"
 				 (or cmdline "")
 				 (org-babel-process-file-name in-file)
@@ -352,7 +358,7 @@ SET COLSEP '|'
 	(progn (insert-file-contents-literally out-file) (buffer-string)))
       (with-temp-buffer
 	(cond
-	 ((memq (intern engine) '(dbi mysql postgresql postgres saphana sqsh vertica))
+	 ((memq (intern engine) '(athena dbi mysql postgresql postgres saphana sqsh vertica))
 	  ;; Add header row delimiter after column-names header in first line
 	  (cond
 	   (colnames-p
@@ -377,7 +383,7 @@ SET COLSEP '|'
 	      (goto-char (point-max))
 	      (forward-char -1))
 	    (write-file out-file))))
-	(org-table-import out-file (if (string= engine "sqsh") '(4) '(16)))
+	(org-table-import out-file (if (memq (intern engine) '(athena sqsh)) '(4) '(16)))
 	(org-babel-reassemble-table
 	 (mapcar (lambda (x)
 		   (if (string= (car x) header-delim)
-- 
2.39.0


  reply	other threads:[~2023-03-14 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 15:40 [patch] ob-clojure: Fix results output Daniel Kraus
2023-03-10 12:35 ` Ihor Radchenko
2023-03-13 14:01   ` Daniel Kraus
2023-03-14 12:35     ` Ihor Radchenko
2023-03-14 13:38       ` Daniel Kraus [this message]
2023-03-14 14:27         ` Daniel Kraus
2023-03-15 10:20           ` Ihor Radchenko
2023-03-15 11:22             ` Daniel Kraus
2023-03-16 10:19               ` Ihor Radchenko
2023-03-19  8:07                 ` Ihor Radchenko
2023-03-19 20:43                   ` Daniel Kraus
2023-03-22 10:48                     ` Ihor Radchenko
2023-03-23 11:31                       ` Daniel Kraus
2023-03-23 11:52                         ` Ihor Radchenko
2023-03-23 12:29                           ` Daniel Kraus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873567h2kk.fsf@kraus.my \
    --to=daniel@kraus.my \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).