In Adam's blog post https://adamj.eu/tech/2022/06/29/run-a-django-migration-by-hand/, he shows a pattern I've used in the past.
Would it be useful to support passing an optional positional argument to dbshell that is then passed to the dbshell program appropriately? e.g., with @filename for Oracle sqlplus or directly to mysql? I suppose that might introduce new code to DatabaseOperations, but not too much. I think only Oracle's DatabaseOperations would be different. I've had to extend Django to run some old PL/SQL via management commands. This helped me with my 16 year old database to replace scripts that used combinations of bash, ksh, sh, expect, perl, sqlplus, and PL/SQL with just two three technologies - namely Python, Django, and PL/SQL. However, since there are 20k lines of PL/SQL and 25k lines of Python, making the PL/SQL go away is not yet a priority. I've done it basically by using code like this in a management command: https://gist.github.com/danizen/a3b5e3f8514be90b796f298dfb52f99e If you look at the "run_report" method of the basereport.py, you'll see that I am using os.pipe() and os.dup2() to enable passing the output of a template to dbshell. This is in case there is any sqlplus reliance in these old reports. In my case, it will be better to assure that all of this report code can run in management commands or directly via cursor execute - and so I haven't proposed this for my use case. The one that Adam proposes makes a much better use case for this additional positional argument to dbshell. Has this been discussed before? -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/aeb4ef0d-e8d6-46c6-9aaa-167abd5de3e5n%40googlegroups.com.