From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>, Xtra Coder <xtracoder(at)gmail(dot)com>, Chris Travers <chris(dot)travers(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Any reasons for 'DO' statement not returning result? |
Date: | 2016-08-16 21:00:23 |
Message-ID: | 4b3ae1ce-2df4-412c-db77-16e9db45f97c@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 08/16/2016 01:15 PM, Jim Nasby wrote:
> On 8/16/16 1:05 PM, Adrian Klaver wrote:
>> On 08/16/2016 07:54 AM, Jim Nasby wrote:
>>> On 8/14/16 5:13 AM, Xtra Coder wrote:
>>>> - ability to switch session language from 'sql' to 'pl/pgsql'
>>>
>>> Actually, something I wish I had was the ability to temporarily switch
>>> to an entirely different interpreter (such as ipython), while still
>>> retaining current database connection and context. That would be
>>> especially useful for debugging plpython functions.
>>
>> What aspects of ipython are you interested in?
>
> First, it's not ipython in particular, just a python environment. What
> would be *really* cool is finding a good way to integrate with Jupyter
> Notebook...
>
> Mostly in being able to deal with plpython code. Right now that's
> difficult because the plpy object is only exposed inside a plpython
> function, and it's a bit painful to get pythonic representations of data
> out of the plpython environment and into a python environment.
>
> Outside of that though, there's still useful things that can be done. I
> think a big part of why people keep asking to add things like IF/THEN to
> psql is because psql is an incredibly useful tool for handling lots of
> SQL statements (either DDL or DML). It's much better at that than any
> other tool I've seen. BUT, there's a limit to what psql or SQL can do.
> String manipulation (for example) pretty much sucks. python (or perl or
> ...) are quite good at that stuff though.
>
> It's certainly not terribly hard to run a query or two from python. But
> a dozen? That becomes very tedious very quickly. And if you're trying to
> do this interactively, it just sucks. (No \d et all, no tab completion,
> no \h, etc).
>
> So what I ultimately wish for is a way to blend these things together as
> needed. What would be truly amazing is if we had a way to pass a
> database connection around to different tools. Do a bunch of SQL stuff
> within psql... now I need to deal with a plpython function; do that in
> Jupyter... now I'm back to SQL, go back to psql.
So a mash up of:
https://github.com/dbcli/pgcli
https://github.com/catherinedevlin/ipython-sql
and from Django
python manage.py shell
>
> I wonder how hard it would be to allow psql to expose a local port that
> other stuff could connect to...
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Piotr Stefaniak | 2016-08-16 21:08:28 | Re: [GENERAL] C++ port of Postgres |
Previous Message | Tom Lane | 2016-08-16 20:59:56 | Re: [GENERAL] C++ port of Postgres |