469,086 Members | 1,287 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,086 developers. It's quick & easy.

Can't Write to PostGIS PostGreSQL database via psycopg2

Hi,

I am sort of in a jam here. I am using the PsycoPG2 library to read
data out of a windows XP based PostGIS / PostGreSQL database but I am
apparently unable to write (update or insert) even though I am able to
read (select)

I am using PsycoPG2 2.0.6 (psycopg2-2.0.6.win32-py2.5-pg8.2.4-
release.exe )
with Python 2.5 (python-2.5.msi)
and PostGres 8.2.5.-1 (postgresql-8.2.5-1.zip)
and PostGIS 8.2 (postgis-pg82-setup-1.3.1-1.exe)

I can use PGadminIII to paste the same SQL queries and execute just
fine, but when I try to execute them via python code like

import psycopg2
conn = psycopg2.connect("dbname='postgis' user='postgres'
host='localhost' password='12345'")
c=conn.cursor()
c.execute("""INSERT INTO thetable (name) VALUES ('asdf');""")
c.execute("""UPDATE thetable SET name = 'somename' WHERE id = 321;""")
print(c.statusmessage)
#returns "INSERT 0 1" and "UPDATE 0" respectively

It gives me very specialized table specific error messages if the
query is wrong, but when it's correct, it does nothing and doesn't
update. The only way I can update is pasting the query into the
PgAdminIII query window.

This is a problem on two separate machines (XP and Windows 2003
server) with all of the above components installed by two different
people.

Any help on this would be greatly appreciated.

Thanks in advance,

Dave

Oct 23 '07 #1
0 1384

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Graeme Matthew | last post: by
1 post views Thread by jason | last post: by
1 post views Thread by Romano J M Silva | last post: by
3 posts views Thread by Keen Anthony | last post: by
12 posts views Thread by Dale Strickland-Clark | last post: by
2 posts views Thread by Paolo | last post: by
reply views Thread by Acm | last post: by
2 posts views Thread by Abandoned | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.