emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [BUG] org babel python execute from local buffer to remote session [


From: Tim Cross
Subject: Re: [BUG] org babel python execute from local buffer to remote session [9.5.4 (9.5.4-ge0b05b @ /home/moutsopoulosg/.emacs.d/elpa/org-9.5.4/)]
Date: Sat, 27 Aug 2022 13:05:21 +1000
User-agent: mu4e 1.9.0; emacs 29.0.50

George Moutsopoulos <gmoutso@yahoo.co.uk> writes:

> Hi all. I often need to run some code on a remote ssh session, because
> only there I can access a database and the environment is hard to
> replicate, while I want to keep the code I run on my local machine.
>
> The remote session is initialised with run-python after I change
> default-directory and use pythonic-activate. Sending commands from a
> local python buffer using python.el works without issues. It would be nice if 
> I can do
> the same from a local org-mode buffer from a python source block.
>

Jujst in case it may be useful, I have found it easiest to use ssh
tunnels in this sort of scenario. If you create an ssh tunnel for the
port you connect to the database with, you can access the database as if
it was running locally.

One advantage of this method is that you can use all the normal tools
and any language, your not restricted to python. I find this useful as
it allows me to use org-mode to manage my database using just sql as
well as using other languages (I don't use python, preferring other
scripting languages, but same basic principals). I mainly use postgres
and with the ssh tunnel approach, I can run the postgres clients locally
and have them connect to remote databases which would normally not be
possible due to firewalls etc. I've done the same with Oracle and
suspect most other dbms would work (as well as other 'services',
provided there is a tcp socket).

The other advantage is that it avoids the need to modify org mode (or
any other tool). You can even use the full power of Emacs' sql mode.



reply via email to

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