Re: Python + PostgreSQL

Lists: pgsql-interfaces
From: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
To: pgsql-interfaces(at)hub(dot)org
Subject: Python + PostgreSQL
Date: 2000-08-02 10:34:19
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

Hi All !

I have installed postgresql-python-7.0.2-2.i386.rpm in a RedHat 6.2 box.
Where can I find documentation for this module ? I'm trying to connect to a
server but the python says 'no password supplied'

import pg

dg = pg.connect("template1", "localhost", 5432)

Regards,

Antonio Navarro Navarro
BemarNet Management
http://www.bemarnet.es
hostmaster(at)bemarnet(dot)es
Tlf. +34-96-1656644
Fax. +34-96-1656514


From: Karl Thomas Diedrich <died9501(at)uidaho(dot)edu>
To: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-02 21:48:51
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

I used the Postgresql python package to write a program. I couldn't find
any documentation either. Examples come in the RedHat package.

I used qit like this:
from pg import DB
cnx = DB("database-name")
cnx.query("""CREATE TABLE ...""")

You can see the full application at http://deodas.sourceforge.net/. Thqe
parts in the the file DEODAS/deodas/src/deodas_mod.py under CVS web.

Karl Diedrich
died9501(at)uidaho(dot)edu
http://www.uidaho.edu/~died9501/
http://deodas.sourceforge.net/

On Wed, 2 Aug 2000, Antonio Navarro Navarro wrote:

> Hi All !
>
> I have installed postgresql-python-7.0.2-2.i386.rpm in a RedHat 6.2 box.
> Where can I find documentation for this module ? I'm trying to connect to a
> server but the python says 'no password supplied'
>
> import pg
>
> dg = pg.connect("template1", "localhost", 5432)
>
> Regards,
>
> Antonio Navarro Navarro
> BemarNet Management
> http://www.bemarnet.es
> hostmaster(at)bemarnet(dot)es
> Tlf. +34-96-1656644
> Fax. +34-96-1656514
>


From: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
To: Karl Thomas Diedrich <died9501(at)uidaho(dot)edu>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-03 07:02:43
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

At 14.48 2/8/00 -0700, Karl Thomas Diedrich wrote:

>I used the Postgresql python package to write a program. I couldn't find
>any documentation either. Examples come in the RedHat package.
>
>I used qit like this:
>from pg import DB
>cnx = DB("database-name")
>cnx.query("""CREATE TABLE ...""")
>
>You can see the full application at http://deodas.sourceforge.net/. Thqe
>parts in the the file DEODAS/deodas/src/deodas_mod.py under CVS web.

Hi Karl !

Yes, this works for localhost and for servers that don't need user
authentication, but I need to connect to a remote server using an specific
username and password... Anyone can help ?

Regards,

Antonio Navarro Navarro
BemarNet Management
http://www.bemarnet.es
hostmaster(at)bemarnet(dot)es
Tlf. +34-96-1656644
Fax. +34-96-1656514


From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Karl Thomas Diedrich <died9501(at)uidaho(dot)edu>
Cc: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>, pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-03 13:59:47
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

Thus spake Karl Thomas Diedrich
> I used the Postgresql python package to write a program. I couldn't find
> any documentation either. Examples come in the RedHat package.

Look at the actual distribution either in the PostgreSQL tree or download
the package from http://www.druid.net/pygresql/ and look at the README file.

> I used qit like this:
> from pg import DB
> cnx = DB("database-name")
> cnx.query("""CREATE TABLE ...""")

The reccommended way is now;

import pg
cnx = pg.DB("database-name")

The reason for this is to make pg.error and possibly other things available.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.


From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-03 14:05:50
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

Thus spake Antonio Navarro Navarro
> I have installed postgresql-python-7.0.2-2.i386.rpm in a RedHat 6.2 box.
> Where can I find documentation for this module ? I'm trying to connect to a
> server but the python says 'no password supplied'
>
> import pg
>
> dg = pg.connect("template1", "localhost", 5432)

If the server requires a password then you need to supply one here. If
you don't need a password (i.e. "psql template1" works) then try this.

import pg
dg = pg.DB("template1")

Note DB is preferred over connect but the main change is not to use localhost
to connect. The default is to use a Unix socket rather than TCP/IP to
localhost and PostgreSQL treats that differently. If localhost was just
used here for illustrative purposes and in fact you are connecting over
TCP/IP to another machine then look at pg_hba.conf to adjust permissions
or add a password to the connection call.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.


From: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
To: pgsql-interfaces(at)hub(dot)org
Cc: darcy(at)druid(dot)net
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 07:01:47
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

At 10.05 3/8/00 -0400, darcy(at)druid(dot)net (D'Arcy J.M. Cain) wrote:

>Thus spake Antonio Navarro Navarro
>> I have installed postgresql-python-7.0.2-2.i386.rpm in a RedHat 6.2 box.
>> Where can I find documentation for this module ? I'm trying to connect to a
>> server but the python says 'no password supplied'
>>
>> import pg
>>
>> dg = pg.connect("template1", "localhost", 5432)
>
>If the server requires a password then you need to supply one here. If
>you don't need a password (i.e. "psql template1" works) then try this.

Hi again !

How must I add the password to the call , maybe

dg = pg.connect("template1", "10.0.0.1", 5432,"username", "password") ?

and where could I find documentation for the different functions supplied
in the package ?

Regards,

Antonio Navarro Navarro
BemarNet Management
http://www.bemarnet.es
hostmaster(at)bemarnet(dot)es
Tlf. +34-96-1656644
Fax. +34-96-1656514


From: "David Lloyd-Jones" <david(dot)lloyd-jones(at)attcanada(dot)ca>
To: <pgsql-interfaces(at)hub(dot)org>, "Antonio Navarro Navarro" <hostmaster(at)bemarnet(dot)es>
Cc: <darcy(at)druid(dot)net>
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 07:33:08
Message-ID: 00f901bffde7$600e8420$67627bd8@WORKGROUP
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

The full text of the O'Reilly book Learning Python is online at
http://www.ibooks.com/ free of charge -- as a promotion for giving them your
e-mail address. They are a new venture hoping to sell "e-books" over the
Net, so this is a promotion to get their list started, and Learning Python
isone of the four books they make available as a freebie.

-dlj.

----- Original Message -----
From: "Antonio Navarro Navarro" <hostmaster(at)bemarnet(dot)es>


From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>
Cc: pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 11:30:23
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

Thus spake Antonio Navarro Navarro
> >If the server requires a password then you need to supply one here. If
> >you don't need a password (i.e. "psql template1" works) then try this.
>
> Hi again !
>
> How must I add the password to the call , maybe
>
> dg = pg.connect("template1", "10.0.0.1", 5432,"username", "password") ?

connect(dbname, host, port, opt, tty, user, passwd)

Set any unused parameters to None.

> and where could I find documentation for the different functions supplied
> in the package ?

In the README that comes with the distribution.

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.


From: Bob Kline <bkline(at)rksystems(dot)com>
To: David Lloyd-Jones <david(dot)lloyd-jones(at)attcanada(dot)ca>
Cc: pgsql-interfaces(at)hub(dot)org, Antonio Navarro Navarro <hostmaster(at)bemarnet(dot)es>, darcy(at)druid(dot)net
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 14:04:08
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

On Fri, 4 Aug 2000, David Lloyd-Jones wrote:

> The full text of the O'Reilly book Learning Python is online at
> http://www.ibooks.com/ free of charge -- as a promotion for giving
> them your e-mail address. They are a new venture hoping to sell
> "e-books" over the Net, so this is a promotion to get their list
> started, and Learning Python isone of the four books they make
> available as a freebie.

Interesting. Unfortunately, their home page doesn't say anything about
this. Have a more direct URL?

--
Bob Kline
mailto:bkline(at)rksystems(dot)com
http://www.rksystems.com


From: "David Lloyd-Jones" <david(dot)lloyd-jones(at)attcanada(dot)ca>
To: "Bob Kline" <bkline(at)rksystems(dot)com>, "David Lloyd-Jones" <david(dot)lloyd-jones(at)attcanada(dot)ca>
Cc: <pgsql-interfaces(at)hub(dot)org>, "Antonio Navarro Navarro" <hostmaster(at)bemarnet(dot)es>, "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 16:31:26
Message-ID: 00b901bffe31$9a293e30$c4587bd8@WORKGROUP
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces


From: "Bob Kline" <bkline(at)rksystems(dot)com> asks:

> On Fri, 4 Aug 2000, David Lloyd-Jones wrote:
>
> > The full text of the O'Reilly book Learning Python is online at
> > http://www.ibooks.com/ free of charge -- as a promotion for giving
> > them your e-mail address. They are a new venture hoping to sell
> > "e-books" over the Net, so this is a promotion to get their list
> > started, and Learning Python isone of the four books they make
> > available as a freebie.
>
> Interesting. Unfortunately, their home page doesn't say anything about
> this. Have a more direct URL?
>

Hi Bob,

Here's my URL for it:

http://www.ibooks.com/SiteSrvr/SSS007X9JCVYKRB0NK5CNL765KAWJ1MKEU3FG/bmrsrc/
WPgs/SiteBrowser.htm?Op=7&BIN=1&frames=1

Problem is, that addresses a cookie on my disk after I've registered for it.

You might give the first part of that, http://www.ibooks.com/SiteSrvr/, a
try and see what happens. Alternately, look for the penguin on the right
hand side of the page, and look at the fine print in its vicinity.

Cheers,

-dlj.


From: Bob Kline <bkline(at)rksystems(dot)com>
To: pgsql-interfaces(at)hub(dot)org
Subject: Re: Python + PostgreSQL
Date: 2000-08-04 17:55:53
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Lists: pgsql-interfaces

On Fri, 4 Aug 2000, David Lloyd-Jones wrote:

> You might give the first part of that,
> http://www.ibooks.com/SiteSrvr/, a try and see what happens.
> Alternately, look for the penguin on the right hand side of the
> page, and look at the fine print in its vicinity.

Tried your suggestions, and have come to the conclusion that they
decided to withdraw the offer.

--
Bob Kline
mailto:bkline(at)rksystems(dot)com
http://www.rksystems.com