473,396 Members | 1,743 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,396 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 1599

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.