Re: Python + listen/notify

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Filipe Brandão <fg(dot)brandao(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Python + listen/notify
Date: 2012-07-11 03:20:47
Message-ID: CAK3UJRGGAw8P2fS=GUu_5MuD6g6LXGw25-v5X+UH68gwHhr4OQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 10, 2012 at 3:56 PM, Filipe Brandão <fg(dot)brandao(at)gmail(dot)com> wrote:
> Hi all.
> I needed to have a trigger firing after a commit, but allready realized it's not possible.
> As i searched upon a solution i came across the LISTEN / NOTIFY. I haven't yet realized exactly what i can do with it, but can i use it to run a simple python script located out my DB?
> Can't run it inside the DB since i need to do it after the completion of a few triggers (after commit).

Certainly: your python program should stay connected to the database,
waiting to receive the NOTIFYs, and then take appropriate action. See:
http://packages.python.org/psycopg2/advanced.html#asynchronous-notifications

Josh

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2012-07-11 03:43:56 Re: Error with plpython
Previous Message Adrian Klaver 2012-07-11 02:39:05 Re: Transaction question