From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 6A9FCYm61F7gHwAA0tVLHw (envelope-from ) for ; Mon, 01 Jun 2020 08:21:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id gLIiBYm61F5cbgAAB5/wlQ (envelope-from ) for ; Mon, 01 Jun 2020 08:21:29 +0000 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 7E56794001C for ; Mon, 1 Jun 2020 08:21:28 +0000 (UTC) Received: from localhost ([::1]:35376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jffhH-0007rp-DI for larch@yhetil.org; Mon, 01 Jun 2020 04:21:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jffgw-0007rb-U2 for emacs-orgmode@gnu.org; Mon, 01 Jun 2020 04:21:06 -0400 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]:32902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jffgv-00011P-53 for emacs-orgmode@gnu.org; Mon, 01 Jun 2020 04:21:06 -0400 Received: by mail-io1-xd41.google.com with SMTP id k18so6058062ion.0 for ; Mon, 01 Jun 2020 01:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dlbRo47JfyxusTGEzv7pqQmcvvyp7UUPmWc55fSuMaQ=; b=qIdKEnLDkyqgOsmuVHuSPfGBA/LG+jO02X94CnYqEyYkHuMD86M+v+K35bJhfx/6V3 davhK9dIwcy0T1Ywsyq1lNABKLDKAegEZ9+3lDjNKCx52kS/N0UBB91QWfTJsxwjHzw8 33LHOYjQAqz9bnl6I8dYI0XbdLHogmgyPLzAor+QrYWC5/QowXbnJr6bh0FTbCKWxYhu SfckKu427rA8jhY2AxIupctqAzUuzPZHroTPCMRddrdvy8aYBLuqteGZrBXRlYT7ZBGD fesQukdQzLD+F4pE34g4PGien1M7QNN9voclaI1LNzS/gF7MlojLbFuraDGN2YzmJYkS 1ckQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dlbRo47JfyxusTGEzv7pqQmcvvyp7UUPmWc55fSuMaQ=; b=IRwP5UteAS1ezWX237O39QTr7Foc3aco3P9+uQE6AIEm5tMTbBvPwhy+lNlZTx9NqC 6qJ9X/4H6/dv4mBHVhIDk3+oUSvl/eyZ34Tq8BCwPbcH4utGKIAGiZrNNcWOIqr6p/4e ES610MNS14vVP9AB9OPfvGspy665wUq7qJwyLG3oeUJGLpsfDzTSlgLjTPKOsOe+8QnU l6Fmkcbfm0Tvx0wwGJ5xHL0QzS2EIjShgIbmIeu57BpNIE82j25mKD6pFA1dtcl7kmvR jmk4WGLADqwjvUr9DtL4ILjXdvGT913hPC41t89rJDSu0eOtrcgLPmntW46Mf4wCYgn2 FO0w== X-Gm-Message-State: AOAM532d7AguXSWoW3V4hP7ZbgEWlVTZGLySl/FleQfjIlZfZrMqpPCz s+atzDH7NxDCs+k3xOqIs0sDOgjuocz++f0b6r5mTk1KZPA= X-Google-Smtp-Source: ABdhPJy2xhPH6MVasGk+oJ15YnxM+R7HKXIteug2TmKiNKNb+VxWLMqcBuK87ON4FGqcXs/lMHFvjxiypq2R1XlCS6Q= X-Received: by 2002:a5d:81d7:: with SMTP id t23mr18426541iol.142.1590999663490; Mon, 01 Jun 2020 01:21:03 -0700 (PDT) MIME-Version: 1.0 References: <87a71s9jio.fsf@kraus.my> <87v9kbttsp.fsf@kyleam.com> In-Reply-To: <87v9kbttsp.fsf@kyleam.com> From: Stefano Rodighiero Date: Mon, 1 Jun 2020 10:20:52 +0200 Message-ID: Subject: Re: [PATCH] ob-sql: Respect database param when using dbconnection To: Kyle Meyer Content-Type: multipart/alternative; boundary="000000000000c7bba805a70179fd" Received-SPF: pass client-ip=2607:f8b0:4864:20::d41; envelope-from=stefano.rodighiero@gmail.com; helo=mail-io1-xd41.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Kraus , emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=qIdKEnLD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.71 X-TUID: WA90vvtUqx6Q --000000000000c7bba805a70179fd Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 1, 2020 at 4:16 AM Kyle Meyer wrote: Daniel Kraus writes: > > > I use ob-sql with the :dbconnection param so I don't have my username > and password in my org file. > > But often I don't want to use the default database from the dbconnectio= n > alist but > > rather specify it explicitly with :database. > > Attached is a patch that fixes this. > Thank you @Daniel > [=E2=80=A6] > From what I can gather from your description, this looks reasonable. > I'm not an ob-sql user, so perhaps I missing something, but would it > make sense for any connection parameter to take precedence if explicitly > given in the source block header (i.e. something like the patch below)? > [+cc Stefano, who added the :dbconneciton feature.] > I think it makes sense. (I personally handle cases like those described by Daniel differently, keeping distinct sql-connection-alist entries for each DB param combination I might need, but I can imagine why someone would want to "override" the database or the host params. For port, user and password I have more difficulties imagining a case where combinations of those params would need override, but I think @Kyle's generic solution is better) s. --=20 www.stefanorodighiero.net --000000000000c7bba805a70179fd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Mon, Jun 1, 2020 at 4:16 AM Kyle M= eyer <kyle@kyleam.com> wrote:<= br>

Daniel Kraus writes:

> I use ob-sql with the :dbconnection param so I don't have my usern= ame and password in my org file.
> But often I don't want to use the default database from the dbconn= ection alist but
> rather specify it explicitly with :database.
> Attached is a patch that fixes this.

Thank you=C2=A0@Daniel
=C2=A0
[=E2=80=A6]
>From what I can gather from your description, this looks reasonable.
I'm not an ob-sql user, so perhaps I missing something, but would it make sense for any connection parameter to take precedence if explicitly given in the source block header (i.e. something like the patch below)?
[+cc Stefano, who added the :dbconneciton feature.]
I think it makes sense.

(I personally= handle cases like those described by Daniel differently,
keeping= distinct sql-connection-alist entries for each DB=C2=A0
param co= mbination I might need, but I can imagine why someone
would want = to "override" the database or the host params.=C2=A0
Fo= r port, user and password I have more difficulties imagining a
ca= se where combinations of those params would need override,
but I = think=C2=A0@Kyle's=C2=A0generic solution is better)

s.


--
--000000000000c7bba805a70179fd--