Hi,
the result of SQL code blocks is not imported corrected correctly into an org
table for the saphana engine.
This happens because the client executable (hdbsql) uses commas and not tabs as
default column separators. The attached patch should fix this.
Best regards,
Ralf
From adf2fa5db624e132e5789b7e2c8556cacff52695 Mon Sep 17 00:00:00 2001
From: Ralf <[email protected]>
Date: Mon, 17 Nov 2025 12:27:13 +0100
Subject: [PATCH] lisp/ob-sql.el: Fix SQL execution for saphana DB
* lisp/ob-sql.el (org-babel-execute:sql): Fix SQL execution for saphana database engine so retrieved columns are correctly identified.
The SAP Hana command line tool 'hdbsql' uses a comma as the default field separator.
Previously the code assumed that a TAB is used which caused a wrong import of the result.
TINYCHANGE
---
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 14ca6bc48..61932dd50 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -387,7 +387,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) '(saphana sqsh)) '(4) '(16)))
(org-babel-reassemble-table
(mapcar (lambda (x)
(if (string= (car x) header-delim)
--
2.43.7