[PyGreSQL] Pygresql and triggers

Daryl Tester dt at picknowl.com.au
Tue Apr 4 22:59:38 EDT 2000


Titus Brown wrote:

> -> I'd like to build an arrangement where I have a python process
> -> triggered by additions to a table (ala a queue type structure).
> -> Is this in the land of feasible, or should I be getting more
> -> sleep before I post such questions?

> While I'm still new to PostgreSQL, I believe what you want is to
> use Python as an embedded procedural language; c.f. p61 of
> 'programmer.pdf' (pg docs).

Hmmm.  Kind of about-faced from what I wanted to do, which was
Python triggered by an event (after table update), then performing
some actions based on table contents.  I'd prefer it this way around,
as the process computations are long and involved, and I don't want
to tie up someone's insert for that length of time (which would appear
to be the case if Python is being used as the embedded procedural
language in the backend).  I did find that section on triggers in the
programmer's reference, and it appears to support your world view,
which is at odds with mine.  :-)

I think I may just code up the sample trigger C code that they use,
and have it "tickle" a domain socket that the external Python process
is listening to.

Thanks,
  Daryl Tester




More information about the PyGreSQL mailing list