473,287 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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 1593

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Graeme Matthew | last post by:
Hi All I have noticed that there are a numbe rof client libraries for connecting to Postgres. Can anyone tell me what is the recommended Python library for database connections many...
1
by: jason | last post by:
Is anyone out there using PostGIS in a production environment? If so does anyone know how well if at all postgresql/postgis work with the likes of ArcSDE and so on? Also if anyone out there...
1
by: Romano J M Silva | last post by:
Hello all, I would like to know if the spatial support available in the 7.4.x versionsof PostgreSQL is the same thing as PostGIS. If not, what are the differences? Is it possible to retrieve...
3
by: Keen Anthony | last post by:
Hello, I am currently using psycopg 2 as my db adapter for a mod_python & PostgreSQL web app. It's works fine, and I haven't any complaints. I would appreciate some input on what other...
12
by: Dale Strickland-Clark | last post by:
Now that OIDs have been deprecated in PostgreSQL, how do you find the key of a newly inserted record? I've tried three Python client libraries, including psycopg2, and where they support cursor...
2
by: Paolo | last post by:
Ciao a tutti, sto cercando di implementare un applicazione che si interfaccia con postgresql(8.1), utilizzando Psycopg2, in ambiente windows (python versione 2.5). Ho installato Psycopg2 e provando...
0
by: Acm | last post by:
I am working with Python 2.5 and Postgresql 8.2.4. I would like to know how to perform the backup and restore operations on postgresql through a python API (e.g. psycopg2). Thank you.
2
by: Abandoned | last post by:
Hi.. I have some dictionary as {2:3, 4:6, 5:7.........} I want to pickle to these dictionary and save to database but i couldn't.. My code for adding.. a=eval(dict) a=pickle.dumps(a, -1)...
1
by: Pradip | last post by:
Hello every body. I am new to this forum and also in Python. Read many things about multi threading in python. But still having problem. I am using Django Framework with Python having PostgreSQL...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.