Use this tag for PostgreSQL issues which are to be solved in accordance with Django coding best practices.
Questions tagged [django-postgresql]
207 questions
1
vote
1 answer
django-hstore compatibility issue with Django 1.6
django-hstore seems to be not compatible with Django 1.6. I have this error on runserver. With Django 1.5.5 everything was correct. Any idea what could be the problem?
Note that I have changed the simplejson import by import json as mentionned in…

Below the Radar
- 7,321
- 11
- 63
- 142
1
vote
0 answers
pytz, Django 1.5, and postgres: DST time zone issues
I've created an events site with Django 1.5.4 and postgres 9.1. The time just changed for "fall back" and all the date/time data entered by admins before the time change are now an hour off.
In my Django settings I have TIME_ZONE = 'America/Chicago'…

katy lavallee
- 2,741
- 1
- 28
- 26
1
vote
0 answers
Postgres insert returning Raw Django Model query not working?
I have a simple model I am inserting into. I am using the following syntax:
m = Model.objects.raw("insert into my_model (col) values ('test') returning *")
In postgres, this returns the identical columns that :
select * from my_model where col =…

Greg
- 6,571
- 2
- 27
- 39
1
vote
0 answers
How can I improve this ugly Postgresql query generated by my possibly poor Django code?
I'm doing this in a Django view:
def by_gear(gear):
types = {
'imaging_telescopes': Telescope,
'guiding_telescopes': Telescope,
'mounts': Mount,
'imaging_cameras': Camera,
'guiding_cameras': Camera,
…

Salvatore Iovene
- 2,064
- 1
- 17
- 31
1
vote
1 answer
Running python manage.py command from django with arguments
I have the command :
./manage.py dbbackup --clean --compress
provided by the django-dbbackup app which performs a backup of my PostgreSQL database to Amazon S3. I am trying to run this command inside a django celery task run daily.
When I run:…

poiuytrez
- 21,330
- 35
- 113
- 172
1
vote
2 answers
How to supply SQL functions and views required for testing Django app
I've created a file /.sql according to the Django docs in order to make use of a hook to pass arbitrary SQL after syncdb is run. Inside this file are two function declarations for PostgreSQL and a statement that creates a database view.…

jnns
- 5,148
- 4
- 47
- 74
1
vote
0 answers
Reset Django database while running
I'm trying to reset my database while Django project's running but I'm having a trouble. Django is constantly interacting with the database due to his mapping between database and models.
I'm using the module reset_db as following :
from…

Kobz
- 469
- 6
- 17
1
vote
1 answer
How to distinctly bulk update all objects of a django model without iterating over them in python?
Basically can we achieve the same result without doing this:
from my_app import models
for prd,count in x.iteritems():
models.AggregatedResult.objects.filter(product=prd).update(linked_epp_count=count)
?
As is evident, x is a dictionary…

Anuvrat Parashar
- 2,960
- 5
- 28
- 55
1
vote
1 answer
Psycopg2 with postgreSQL & django
Mac OSX 10.8
Python 2.7 (installed with homebrew)
PostgreSQL 9.4 (installed with homebrew)
psycopg2 2.5 (installed with macports)
Django 1.0.4 (installed with homebrew)
I'm using this tutorial and currently trying to configure a database. I…

aloe-sarah
- 47
- 5
1
vote
0 answers
Django signal database change on template
I'm building a GPS Tracking System using Django, i should have a grid on my template that display real time information of cars (position,vitesse, temperature...). GPS send data to Postgres DataBase via a module that parse Data and saved it in…

Saif Jerbi
- 667
- 5
- 16
1
vote
1 answer
How to debug a Internal Error current transaction is aborted, commands ignored until end of transaction block?
I am coming across this error current transaction is aborted, commands ignored until end of transaction block,
the traceback is too long so, am printing out the line that seems to cause the error,
File…

Suziemac Tani
- 455
- 9
- 23
1
vote
0 answers
Django long running scripts and DB CPU usage
I running a script that uses Django ORM. The script runs for long time sometimes more than three days. Script looks like below
from app.models import *
for i in some_simpe_select():
more_simple_selects()
processing_for_few_minutes()
…

Shekhar
- 7,095
- 4
- 40
- 45
1
vote
0 answers
Django-Axes causing DatabaseError - Transaction Block
So I've updated django to 1.4.5 and postgres to 9.2.3 and psycopg2 to 2.4.6 . I runserver and everything looks ok, but when i go to localhost:8000 i see the infamous 'current transaction aborted..' on request.session.save() in…

Neara
- 3,693
- 7
- 29
- 40
1
vote
1 answer
Heroku Django Postgres syncdb error
Heroko Config
DATABASE_URL: postgres://xxxxxxxx:xxxxxxxxxx@ec2-54-243-215-140.compute-1.amazonaws.com:5432/xxxxxxxxx
HEROKU_POSTGRESQL_GOLD_URL: …

Mert Can Dinler
- 19
- 1
1
vote
1 answer
URL mapping to postgreSQL schemas (with Route 53?)
I am using multiple PostgreSQL schemas to provide data separation and segmentation. There is a pretty good tutorial on how to do that here, but one thing I do not like about this approach is that it is absolutely reliant on the URL to select a…

Goro
- 9,919
- 22
- 74
- 108