Postgres COPY Command with python 2.3 pg

Michael Lang Michael.Lang at jackal-net.at
Tue Feb 15 16:12:36 EST 2005


On 2005-02-15, @(none) <""> wrote:
> Michael Lang wrote:
>> using psql it works fine, but i dont know how to get it working in python.
>> Ive already made the calls but the changes never apper, and no error.
>
> Which Postgres module are you using? I had the exct same problem when I 
> first started using pyPgSQL, until I figured out that I needed to do:
>
>      db = PgSQL.connect(DSN)
>      db.autocommit = 1
>      con = db.cursor()

Hi, 

im using PostgreSQL RPM from Fedora Core3 
$ rpm -q postgresql-python
postgresql-python-7.4.6-1.FC3.2

code looks like
Python 2.3.4 (#1, Oct 26 2004, 16:42:40)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pg
>>> db = pg.DB('bind9', '192.168.192.2', 5432, None, None, 'named', None)
>>> dir(db)
['_DB__args', '_DB__attnames', '_DB__pkeys', '__doc__', '__init__', '__module__', '_do_debug', 'clear', 'close', 'db', 'debug', 'delete', 'endcopy', 'fileno', 'get', 'get_attnames', 'get_databases', 'get_tables', 'getline', 'getlo', 'getnotify', 'insert', 'inserttable', 'locreate', 'loimport', 'pkey', 'putline', 'query', 'reopen', 'reset', 'source', 'transaction', 'update']

so theres no cursor i could try like your code does ... 
thanks for your response ...

>
> In my code.



More information about the Python-list mailing list