From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gGSSM0ctxWM3ewAAbAwnHQ (envelope-from ) for ; Mon, 16 Jan 2023 11:56:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EEJ/M0ctxWNMgwAAauVa8A (envelope-from ) for ; Mon, 16 Jan 2023 11:56:07 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8D1079D9F for ; Mon, 16 Jan 2023 11:56:07 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHN9a-0003kj-UA; Mon, 16 Jan 2023 05:55:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHN9Q-0003jD-Bm for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 05:55:41 -0500 Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1pHN9O-0002bU-Cf for emacs-orgmode@gnu.org; Mon, 16 Jan 2023 05:55:39 -0500 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4NwTSx0zRVz9sZV for ; Mon, 16 Jan 2023 11:55:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kraus.my; s=MBO0001; t=1673866529; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=gaL74UPqRHxf3wHottS7DLXQQ+Mtbdp4ZpSQFQ4Vg6Y=; b=oEmnjS6iZB1SRyZMF6ACgw1HTK2AR+W/ESRzWHmRTpJYtBFH5T2irkhhyc6wxpYn9FRYaL 91+Uww7ONM2ixix3dYiWBwu56xKpcTOo2TbGlOulOw6ChRnLfgbr1ACdcDXA5Tcix15zcC r/eXtOPqsGpCyaPDuRl0XUUTylkMik4JlgwR6vvMzFbdOGsVIGdobMCnwMIFpjP6TU4FRE Unf6ZhBpc8ufjkEonUCiHVHwq9+7Pma0DrlTdnScpHg0ZN6bHGJhtYWAOEDyFRIGp5v4U5 sFp9inJCBNFp7NbBdd7eUNRnJ7wzle4ZsvDmJro+oOb+DEHHtyJ12WAsYmI+kg== From: Daniel Kraus To: emacs-orgmode@gnu.org Subject: [PATCH] ob-sql: Add support for Athena Date: Mon, 16 Jan 2023 11:48:45 +0100 Message-ID: <874jsqbvfq.fsf@kraus.my> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Rspamd-Queue-Id: 4NwTSx0zRVz9sZV Received-SPF: none client-ip=2001:67c:2050:0:465::101; envelope-from=daniel@kraus.my; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1673866567; a=rsa-sha256; cv=none; b=WeZGwm0ddT1PsFRmR12BadVcWI+/AmXEeFRDtWnHPbfQtKXhIHOCsZzC14N2u4pfrQ+7di m3PHfae7P8ZoAwY4HMZpSPCNYQKeQwqASlVw8b/AokkwJJ3kL2i7XweiXgVPRQ4I9kCMfU e221yAgfg5omsRHz7FGxVL3fbt0wg+rlRqwOI1pBpG/n3cfiVOUJC70H67pazUng1J5lhA ymVjBBigw7i8uXHPXUk+2Mafy1M3crk8E9SwLMi22O01ZxOOqk8inzdco5xhxHo+pHRxho QusA76oUrTs08xssMqWrfvyDPClE/LXZl8VBcM16T46+AKG0mBL0+ImYo0amcA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=oEmnjS6i; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1673866567; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=gaL74UPqRHxf3wHottS7DLXQQ+Mtbdp4ZpSQFQ4Vg6Y=; b=H9l4YSTnpBrhBU8u5+i0RfweD6BMh729o7wEnA90SMdOln+fdumulIYHGpWvhMPyt6F67I I3my2RrEjCgLsBCsZ48UDtX86x5ZZiGe8XRKWUT8v1TUr8O9v/GWyZd5zTQhevzeHZ/OBt nydQD7KuOofmoLTIAPzf3Xt3QSlOXogPoI6EI2jg3FqAFB8ApycmlgTKQ5TuYeocK5Sc1n zltp7qpDSN2fU0X7mgzOuapB18qVZSGRy2Aw9El4uZwFC3prjvqHLHWXb8OowV+jTWMHPx 8c8gCm0/aEsp7KXbq6jE4t4pMm64SbrG36oOizrT/lUfkJXti6PqxU8yfEs7rw== X-Migadu-Spam-Score: -3.82 X-Spam-Score: -3.82 X-Migadu-Queue-Id: 8D1079D9F X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kraus.my header.s=MBO0001 header.b=oEmnjS6i; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none X-TUID: H5bT5g9J0HD6 --=-=-= Content-Type: text/plain Hi, I'm using this patch since a few month that adds support for AWS Athena. The only thing that's maybe against adding it is that `athenacli` (https://github.com/dbcli/athenacli) is not an official AWS tool but just a Python script. What's the opinion on this? Cheers, Daniel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-sql.el-Add-support-for-Athena.patch >From ddace051205d20b24c047962ca9d1335bdd90284 Mon Sep 17 00:00:00 2001 From: Daniel Kraus 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 --=-=-=--