Won't this do the trick?

diff --git a/django/db/backends/oracle/client.py
b/django/db/backends/oracle/client.py
index 102e77fd15..1a0e1ca10b 100644
--- a/django/db/backends/oracle/client.py
+++ b/django/db/backends/oracle/client.py
@@ -8,5 +8,5 @@ class DatabaseClient(BaseDatabaseClient):

     def runshell(self):
         conn_string = self.connection._connect_string()
-        args = [self.executable_name, "-L", conn_string]
+        args = ['rlwrap', '--histsize', '2000', self.executable_name,
"-L", conn_string]
         subprocess.check_call(args)

I'd suggest trying it in the third party backend first. Also the history
size probably doesn't need an easy way to specify, you could just give it
sensible default on a class level attribute on the DatabaseClient class so
if it *really* needs specifying, projects can subclass their own backend.

On Thu, 28 Jun 2018 at 17:56, Dan Davis <dansm...@gmail.com> wrote:

>
> After some work, I've modified django.db.backends.oracle.client in my
> virtual environment so that it will invoke Oracle's sqlplus within the
> excellent utility rlwrap.
> In my shell, I have
>
> * alias sqlplus='rlwrap --histsize 2000 sqlplus'
>
> However, it is not secure for a project like Django to use
> subprocess.check_call with shell=True.
>
> To turn this into a permanent feature, I'd need to:
>
>    - Figure out how users should specify the path to rlwrap, or how to
>    look for the rlwrap utilityp
>    - Figure out how users should specify the size of history.
>
>
> This could also be integrated with a 3rd party backend, such as
> django-oraclepool and django-oracle-drcp (the latter I've contributed to).
>
> In any case, how would developers suggest I proceed to make this a basic
> option of the Oracle backend?
>
> Thanks,
>
> -Dan
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/5af25634-2093-451f-8b50-2c1dffb93cf8%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/5af25634-2093-451f-8b50-2c1dffb93cf8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM0tg6iw85tx8ZuE%3DqyKyZouzxjBWc66sDBMkKiTf-F6XQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to