Re: psycopg help

From: "Lee Harr" <missive(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: psycopg help
Date: 2004-10-14 20:52:33
Message-ID: BAY2-F34X2CTp2hFOWd0003796f@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>My very simple table creation test (based on their "first.py"
>example is failing ... Here's what I'm trying. Non-pythonated
>syntax works in pgsql:
>
>no go:
> curs.execute("""CREATE TABLE key_test (
> key_col CHAR(9) PRIMARY KEY,
> nother_col CHAR(256))""")
>

Works fine for me:

>>>d=psycopg.connect('dbname=lee user=lee')
>>>c=d.cursor()
>>>c.execute("""CREATE TABLE key_test (
... key_col CHAR(9) PRIMARY KEY,
... nother_col CHAR(256))""")
>>>c.execute('''INSERT INTO key_test
... VALUES ('test1', 'test2')''')
>>>c.execute('''SELECT * FROM key_test''')
>>>r=c.fetchall()
>>>r
[('test1 ', 'test2
')]
>>>d.commit()

Perhaps if you showed us any error messages you
are getting we might be able to help.

Also helpful is the version of any and all pieces
(postgres version, and psycopg version, and
python version at least)

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.com/

Browse pgsql-general by date

  From Date Subject
Next Message Dev 2004-10-14 20:54:56 Count Issues
Previous Message Bambero 2004-10-14 20:43:44 Boolean