62
votes
9answers
29k views

DatabaseError: current transaction is aborted, commands ignored until end of transaction block

I got a lot of "DatabaseError: current transaction is aborted, commands ignored until end of transaction block" errors after changed from python-psycopg to python-psycopg2 as Django project's database ...
7
votes
7answers
4k views

Escape SQL “LIKE” value for Postgres with psycopg2

Does psycopg2 have a function for escaping the value of a LIKE operand for Postgres? For example I may want to match strings that start with the string "20% of all", so I want to write something like ...
10
votes
7answers
2k views

Postgresql socket error on OSX 10.7.3 when running Django's syncdb

Since upgrading OSX to version 10.7.3, when I attempt to run a Django "syncdb" command, I receive the following psycopg2 error from Postgresql 8.4.2: psycopg2.OperationalError: could not connect to ...
9
votes
2answers
5k views

Can't connect the postgreSQL with psycopg2

It's the first time that I can't find the answer about some tech problems Here's my problems: >> conn=psycopg2.connect(database="mydb", user="postgres", password="123",port=5432) Traceback ...
6
votes
1answer
2k views

pip install fails with /usr/bin/clang: No such file or directory

I am migrating my dev environment to 10.8, however I am having issues with pip. Specifically, I'm using a virtualenvs/virtualwrapper but cannot pip install psycopg2, and during the building of the ...
11
votes
2answers
6k views

Installing psycopg2 (postgresql) in virtualenv on windows

I installed psycopg2 in virtualenv using easy_install psycopg2. I did not see any errors and looks like installation went fine.. there is an egg file created in the site-packages dir for psycopg2.. ...
0
votes
1answer
395 views

Issue for insert using psycopg

I am reading data from a .mat file using the Pytables module. After reading the data, I want to insert this data into the database using psycopg. Here is a sample code piece: file = ...
13
votes
4answers
26k views

How to setup PostgreSQL Database in Django?

I'm new to Python and Django. I'm configuring a Django project using PostgreSQL database engine backend, But I'm getting errors on each database operations, for example when i run manage.py syncdb, ...
10
votes
1answer
1k views

Recreating Postgres COPY directly in Python?

I have a block of data, currently as a list of n-tuples but the format is pretty flexible, that I'd like to append to a Postgres table - in this case, each n-tuple corresponds to a row in the DB. ...
9
votes
1answer
3k views

Use binary COPY table FROM with psycopg2

I have tens of millions of rows to transfer from multidimensional array files into a PostgreSQL database. My tools are Python and psycopg2. The most efficient way to bulk instert data is using ...
4
votes
5answers
3k views

PostgreSQL - how to run VACUUM from code outside transaction block?

I am using Python with psycopg2 and I'm trying to run a full VACUUM after a daily operation which inserts several thousand rows. The problem is that when I try to run the VACUUM command within my ...
5
votes
3answers
1k views

I'm trying to install psycopg2 onto Mac OS 10.6.3; it claims it can't find “stdarg.h” but I can see it's there; what should I do?

I'm desperately trying to successfully install psycopg2 but keep running into errors. The latest one seems to involve it not being to find "stdarg.h" (see code below). However I can see with my own ...
3
votes
5answers
8k views

Why can't I install psycopg2? (Python 2.6.4, PostgreSQL 8.4, OS X 10.6.3)

ORIGINAL MESSAGE (now outdated): After running python setup.py install I get the following: Warning: Unable to find 'pg_config' filebuilding 'psycopg2._psycopg' extension gcc-4.0 -arch ppc -arch ...
1
vote
2answers
420 views

psycopg2 E' on table, field and schema

I am having the same problem as: python adds "E" to string All the answers given are relevant, but I am breaking my neck on this one. The problem is that psycopg2 not only escapes values, ...
3
votes
1answer
417 views

psycopg2 mapping Python : “list of dicts” to Postgres : “array of composite type” for an INSERT statement

Postgres version : 9.1.x. Say I have the following Schema: DROP TABLE IF EXISTS posts CASCADE; DROP TYPE IF EXISTS quotes CASCADE; CREATE TYPE quotes AS ( text CHARACTER VARYING, is_direct ...

1 2 3
15 30 50 per page