pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erny <aerd@mx3.redestb.es>
To: pgsql-interfaces@postgresql.org
Subject: Pygresql importing of largeobjects with loimport
Date: Thu, 24 May 2001 04:46:07 +0200
Message-ID: <3b0c7b26@news> (raw)

Dear everybody,

This:
>>> import pg
>>> db=pg.DB()
>>> db.loimport("/myfile")

does not work, because Postgres requires to include this in a transaction.
So hou have to:
>>> import pg
>>> db=pg.DB()
>>> db.query("BEGIN")
>>> db.loimport("/myfile")
>>> db.query("END")                # or COMMIT

Note that this is not necessary if doing a
db.query("select lo_import('/myfile')")
which is not the same as in the first example, is accessed locally from
libpq, and in the second example it is loaded from within the server, so it
must be accessible by the servir with the specified path.

Erny







Message-ID: <3b0c7b26@news>
Permalink:  ../3b0c7b26@news/
Also on:    postgresql.org/message-id/3b0c7b26@news

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: aerd@mx3.redestb.es
  Subject: Re: Pygresql importing of largeobjects with loimport
  In-Reply-To: <3b0c7b26@news>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox