Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f4SCRKA91893 for ; Mon, 28 May 2001 08:27:20 -0400 (EDT) (envelope-from pgsql-interfaces-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4O3voA96004 for ; Wed, 23 May 2001 23:57:50 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f4O3i9n24366 for pgsql-interfaces@postgresql.org; Wed, 23 May 2001 23:44:09 -0400 (EDT) (envelope-from news) From: "Erny" X-Newsgroups: comp.databases.postgresql.interfaces Subject: Pygresql importing of largeobjects with loimport Date: Thu, 24 May 2001 04:46:07 +0200 Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Original-NNTP-Posting-Host: 212.166.171.28 Message-ID: <3b0c7b26@news> To: pgsql-interfaces@postgresql.org X-Archive-Number: 200105/113 X-Sequence-Number: 1643 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