emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add support for prologue and epilogue in SQL code blocks


From: Rodrigo Morales
Subject: [PATCH] Add support for prologue and epilogue in SQL code blocks
Date: Sat, 03 Jul 2021 02:00:07 -0500

I'm creating this patch because the prologue and epilogue header
arguments can be useful for SQL code blocks. For example, in PostgreSQL
:prologue can be used for setting the schema name where operations are
to be executed (see example below)

#+BEGIN_SRC org
* The foo schema
:PROPERTIES:
:HEADER-ARGS:SQL+: :engine postgres
:HEADER-ARGS:SQL+: :prologue "SET search_path = foo;"
:END:

The following code block shows the table in the =foo= schema.

,#+BEGIN_SRC sql
\dt;
,#+END_SRC

The following shows the tuples in the table =A=.

,#+BEGIN_SRC sql
SELECT * FROM A;
,#+END_SRC

The following shows the tuples in the table =B=.

,#+BEGIN_SRC sql
SELECT * FROM B;
,#+END_SRC
#+END_SRC

PS: This is the second time I'm creating a patch, so I would really
appreciate any feedback if I've done something wrong.


-- 
La información contenida en este e-mail y sus anexos es confidencial, 
privilegiada y está dirigida exclusivamente a su destinatario, en 
consecuencia, solo puede ser utilizada por aquel. Si usted no es el 
destinatario original, no deberá examinar, usar, copiar o distribuir este 
mensaje o la información que contiene. Si lo recibe por error, por favor 
reenvíelo a la persona que se lo envió y elimínelo. Cualquier retención o 
uso total o parcial no autorizada de este mensaje está estrictamente 
prohibida y sancionada por ley.

Attachment: 0001-lisp-ob-sql.el-Add-support-for-prologue-and-epilogue.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]