From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id PHN9Ob5Cvl/VVgAA0tVLHw (envelope-from ) for ; Wed, 25 Nov 2020 11:40:46 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id OCgVNb5Cvl8iLwAAbx9fmQ (envelope-from ) for ; Wed, 25 Nov 2020 11:40:46 +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 55F049403A8 for ; Wed, 25 Nov 2020 11:40:46 +0000 (UTC) Received: from localhost ([::1]:56374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khtAD-0006HV-Bl for larch@yhetil.org; Wed, 25 Nov 2020 06:40:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kht9p-0006HO-RM for emacs-orgmode@gnu.org; Wed, 25 Nov 2020 06:40:21 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:39006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kht9o-000444-1x for emacs-orgmode@gnu.org; Wed, 25 Nov 2020 06:40:21 -0500 Received: by mail-pg1-x52c.google.com with SMTP id f17so2219500pge.6 for ; Wed, 25 Nov 2020 03:40:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=EUe3wsxdH6nybEvQudejKeAy6gk3MPbtSHZeqZR0UPQ=; b=i8iVLVKCh/4kAmFGlBLo15VmAQTBCAS1re0/wDkAHQ0T6SvuyYslD7xUGOXxqHJXwo T18FQsHbC+cOQ18mgC960H1f+O327EH0tePJKXmX8tOuY38MUh/OynZlfK1YaRv+QICK HK6OIl1z3uwlWzZ1Eko+bxIzymoIs4SMuTq0UH3r9ht7uO7FXmo64go0uNZJHdRnodym 5LBWRhIVT0AOv42s9rDla2E8m9xiMG/26TMkJxv2eQT8QsPjzXaHHYyYnG3WvRfJ23pN krchOn8A6ZZ3cHzQBU6OZIG8mhnn70z3nAeoemeFrUhBSDWO6SvmzIPlJdM8CWZE7ydQ jeAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=EUe3wsxdH6nybEvQudejKeAy6gk3MPbtSHZeqZR0UPQ=; b=qzYynGO3o2cesTDQRqbiSFYDTLfiTtz/+Q4RNZCNtZkfp1ivDdJT5gGL9vTXST6Zdc lfGWLCU+LGXlduMkQtGD7PyivABz/9sveinuLHc+lnI8+yUDIcdNUiePssGPq0Sub7Yv oxqq1RdG12RWSwI260iMmngvLoVc00m7TH77W0pEgDcUvRO73pD/d3e2IYYjGA4jZ41d fUF07TcXISysq15f/E7tOJRNlnvdOyiCFMZGnm+j9Xd6abXRXtYqeD7aXgd2XOvmg0cf +BYW4ud4ksnNQclDF9JiWRdrhRHhI3wYh9mZTl8biSOrFyy5GHgPYjq9ckpjz2Bjn7ho 2zsg== X-Gm-Message-State: AOAM532G8y+M3C+9gUmvC7+eiDZq6SbszEwMLPM6gou+xGNCkmWdthPo tgb44nBDNp+VEb0QnlQHS70= X-Google-Smtp-Source: ABdhPJwwgAq086sL0vO9zC+TTfrcDGNyXLIY2QqRCpWFj6J35ERX6HmGbudpssap0HIFYwJ6R29HQA== X-Received: by 2002:aa7:9409:0:b029:18b:9e20:b9df with SMTP id x9-20020aa794090000b029018b9e20b9dfmr2660094pfo.63.1606304417940; Wed, 25 Nov 2020 03:40:17 -0800 (PST) Received: from localhost ([23.27.206.160]) by smtp.gmail.com with ESMTPSA id r11sm2771587pjd.52.2020.11.25.03.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 03:40:17 -0800 (PST) From: Ihor Radchenko To: Jean Louis , Texas Cyberthal , "emacs-orgmode@gnu.org" Subject: Re: org-sbe to automate some source block executions In-Reply-To: References: <87mtz84om9.fsf@localhost> <87ft4zhyuo.fsf@disroot.org> Date: Wed, 25 Nov 2020 19:39:03 +0800 Message-ID: <87im9tbr8o.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=yantar92@gmail.com; helo=mail-pg1-x52c.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=i8iVLVKC; 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: -1.21 X-TUID: 8axMB38FLyvW > I am trying to implement it, do you see here anything below that I am > doing wrong? Error is that it cannot find source block stages You should assign a name to your source block. Also, I am clueless why you need a variable ":var results=stages". You should probably do something like the following: ** Stages #+name: stages #+BEGIN_SRC sql :engine postgresql :exports results SELECT -- salesflowstages_priority AS "Priority", salesflowstages_publicstage AS "Development Stages" --, -- salesflowstages_description AS "Description" FROM salesflowstages WHERE salesflowstages_salesflows = 1 ORDER BY salesflowstages_priority ASC #+END_SRC # Local Variables: # eval: (org-sbe "stages") # End: Best, Ihor Jean Louis writes: > * Eric S Fraga [2020-11-24 12:46]: >> On Tuesday, 24 Nov 2020 at 12:00, Jean Louis wrote: >> > Can I automated the execution of Babel code upon opening of the Org >> > file? >> >> You can, by using file local variables. For instance, for some files, I >> do this: >> >> #+begin_src org >> ,* local variables :noexport: >> # Local Variables: >> # eval: (org-sbe "startup") >> # End: >> #+end_src >> >> which will evaluate the named src block "startup" when file is >> opened. > > I am trying to implement it, do you see here anything below that I am > doing wrong? Error is that it cannot find source block stages > > ** Stages > > #+BEGIN_SRC sql :var results=stages :engine postgresql :exports results > SELECT -- salesflowstages_priority AS "Priority", > salesflowstages_publicstage AS "Development Stages" --, > -- salesflowstages_description AS "Description" > FROM salesflowstages > WHERE salesflowstages_salesflows = 1 > ORDER BY salesflowstages_priority ASC > #+END_SRC > > # Local Variables: > # eval: (org-sbe "stages") > # End: