Tagged Questions
61
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 ...
14
votes
1answer
11k views
Use Django ORM as standalone [duplicate]
Possible Duplicates:
Use only some parts of Django?
Using only the DB part of Django
I want to use the Django ORM as standalone. Despite an hour of searching Google, I'm still left with ...
8
votes
5answers
3k views
python pip install psycopg2 install error
I did a simple pip install psycopg2 on mac system. It installed fine, but when I try to use psycopg2 I get the error:
Reason: Incompatible library version: _psycopg.so requires version 1.0.0 or ...
24
votes
2answers
13k views
Can't subtract offset-naive and offset-aware datetimes
I have a timezone aware timestamptz field in PostgreSQL. When I pull data from the table, I then want to subtract the time right now so I can get it's age.
The problem I'm having is that both ...
10
votes
3answers
6k views
How do I do database transactions with psycopg2/python db api?
Im fiddling with psycopg2 , and while there's a .commit() and .rollback() there's no .begin() or similar to start a transaction , or so it seems ?
I'd expect to be able to do
db.begin() # possible ...
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 ...
7
votes
5answers
2k views
python adds “E” to string
This string:
"CREATE USER %s PASSWORD %s", (user, pw)
always gets expanded to:
CREATE USER E'someuser' PASSWORD E'somepassword'
Can anyone tell me why?
Edit:
The expanded string above is the ...
5
votes
3answers
986 views
Complex foreign key constraint in SQLAlchemy
I have two tables, SystemVariables and VariableOptions. SystemVariables should be self-explanatory, and VariableOptions contains all of the possible choices for all of the variables.
VariableOptions ...
7
votes
7answers
4k views
storing uploaded photos and documents - filesystem vs database blob
My specific situation
Property management web site where users can upload photos and lease documents. For every apartment unit, there might be 4 photos, so there won't be an overwhelming number of ...
9
votes
1answer
3k views
How to debug: Internal Error current transaction is aborted, commands ignored until end of transaction block
Hi Stackoverflow people,
I do my first steps with GeoDjango and I am looking for better options to check faulty sql statements.
So far, I simply wanted to safe a lng+lat point in my postgresql ...
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..
...
4
votes
3answers
2k views
Postgres - how to return rows with 0 count for missing data?
I have unevenly distributed data(wrt date) for a few years (2003-2008). I want to query data for a given set of start and end date, grouping the data by any of the supported intervals (day, week, ...
8
votes
4answers
3k views
Parameterized queries with psycopg2 / Python DB-API and PostgreSQL
What's the best way to make psycopg2 pass parameterized queries to PostgreSQL? I don't want to write my own escpaing mechanisms or adapters and the psycopg2 source code and examples are difficult to ...
4
votes
3answers
2k views
Django cache.set() causing duplicate key error
My Django site recently started throwing errors from my caching code and I can't figure out why...
I call:
from django.core.cache import cache
cache.set('blogentry', some_value)
And the error ...
2
votes
1answer
402 views
Optimizing performance of Postgresql database writes in Django?
I've got a Django 1.1 app that needs to import data from some big json files on a daily basis. To give an idea, one of these files is over 100 Mb and has 90K entries that are imported to a Postgresql ...