0
votes
0answers
17 views

Sort by Count of Many to Many Relationship - SQLAlchemy

I am using Flask-SQLAlchemy to to query my Postgres database. I am currently trying to query for suggestions of titles with the following query: res = ...
-1
votes
0answers
22 views

How to genarate point in postgresql, from latitude and longitude value [on hold]

How to get map with the input of Latitude and Longitude, I am using OpenERP 7, and I installed base_geoengine module. In my form i have 3 fields ie latitude longitude and map this latitude and ...
1
vote
1answer
18 views

Connecting to PostgreSQL as root through psycopg2

I'm trying to run a Python service using supervisord, which needs to be run as root (sudo supervisorctl). The Python service tries to connect to PostgreSQL using psycopg2 through a call that looks ...
0
votes
1answer
16 views

How could one use Python's DBAPI to portably validate a database schema?

I'm writing a utility which I intend to be useable with at least three different database server backends (SQLite3, PostgreSQL, and MySQL). I'm not using an ORM (though I try a fork using SQLAlchemy ...
0
votes
0answers
32 views

Restarting postgresql gives error in ubuntu

When I run this command I get the following error: postgres@ri-desktop:~$ psql psql: could not connect to server: No such file or directory Is the server running locally and accepting ...
0
votes
2answers
36 views

Is it faster to insert null values on db or to test if it is null and not insert? [on hold]

Im using python and postgresql. I have a lot of colums that are default null. Is it faster to insert null values or test if rhe values are not null and only insert in that case? The query is one big ...
0
votes
0answers
42 views

(Nginx + uWSGI + Django) slows down after a few days

Simply put after a few days (and thousands of requests) our web application slows down. Our setup: 2 load-balancer servers (HAProxy) one master and one slave 4 web servers (Nginx + uWSGI + Django) ...
0
votes
0answers
27 views

Using sqlalchemy to create an index on a json key (expression index)

The situation is I have a JSON column type in a postgresql table. I'd like to create an index on one or more of the keys in the json. I believe I know how to do this using sql (Side note: I was under ...
0
votes
1answer
26 views

Django doesn't update postgresql database

I recently switched form a SQL Lite DB to a Postgresql DB for my Django project. I was not far in, so I did no migrations and just started with a clean DB. I followed the instructions found here ...
2
votes
1answer
38 views

django: Proper way to recover from IntegrityError

What's the proper way to recover from an IntegrityError, or any other errors that could leave my transactions screwed up without using manual transaction control? In my application, I'm running into ...
1
vote
1answer
17 views

psycopg2 executemany not working

If I run cur.execute('SELECT * FROM some_table WHERE some_column = %s;', ('some_value',)) then a call to cur.fetchall() immediately afterwards succeeds, and produces an output that is entirely ...
0
votes
1answer
29 views

.execute('INSERT …') does not actually insert data into table

warning: brain fart imminent I've been at this for a bit now, and I'm guessing this is just a "I'm tired, can't get it through my head" type of issue so I'm hoping you will break this down for me.. ...
1
vote
0answers
41 views

Django python syntax error in views.py

I recently had this issue with my web application in Django : SyntaxError at / invalid syntax (views.py, line 98) Request Method: GET Request URL: http://craft.irisa.fr/ Django Version: 1.6.5 ...
0
votes
0answers
14 views

Django MultiValueDictKeyError in admin, only on update with inlines

I have seen several posts on this error in relation to < 1.6.2, however, I am running version 1.6.2 and I am seeing this, but it is ONLY happening on updates, not in inserts. I always get a ...
0
votes
1answer
19 views

SQLAlchemy: Execute/Add a function to a column in sqlalchmey

I'm using SQLAlchemy and I have a query from which one of the columns I obtain is a constant QUOTE_STATUS_ERROR, the values in this column are integers. Since the constant value doesn't mean anything ...
0
votes
2answers
21 views

Django: ProgrammingError when dealing with ManyToMany database

Started using ManyToMany relationships in my postgresql database, but I end up with "Programming Error : relation "sequences_sequence_access" does not exist" can someone please explain to me my ...
1
vote
1answer
30 views

Python: Start psql query, don't wait for response

I am using python and psycopg2 to start a COPY TO CSV that will take a long time (possibly hours). The copy to file work is to be handled by postgres, so no information needs to be returned to my ...
0
votes
1answer
11 views

Python psycopg2-2.5.1 installation on Windows 8

I am installing Python psycopg2 , its compilation fails: OS: Windows 8 64 bit Python: 2.7 mingw-w64 C:/mingw-w64/x86_64-4.9.0-win32-seh-rt_v3-rev2/mingw64/bin/../lib/gcc/x86_64-w64 ...
0
votes
1answer
25 views

Fast and efficient random queryset - Django [duplicate]

I look on some posts in SO about random queryset in Django. All i can find is that order_by('?') is not fast and efficient at all, but my experience does not tell so. I have a table with 30.000 ...
1
vote
1answer
25 views

Why I cannot create a database for graphite-web?

I am trying to install graphite-web on my computer by following the instructions on https://gist.github.com/surjikal/2777886. When I try to populate the database with manage.py syncdb it does not find ...
1
vote
1answer
17 views

SQLAlchemy: Filtering across many-to-many yet returning all results

Starting from the many-to-many Blog and Tag model and query from Querying a many-to-many relationship in SQLAlchemy, I know that ...
0
votes
0answers
22 views

Psycopg2 installation for OS X and Django

I would like to use the PostGreSQL database with Django. I first installed the driver psycopg2 with pip and virtualenv: $ PATH=$PATH:/Library/PostgreSQL/9.3/bin/ $ pip install psycopg2 [...] ...
3
votes
0answers
26 views

txpostgres stored procedure returns cursor

I'm trying to get a cursor from stored procedure in txpostgres. Psycopg2 has a named cursors which are working fine for it. But there is no curs = conn.cursor('name') statement in txpostgres. Is ...
0
votes
2answers
33 views

How can i get the list of databases in Postgresql in python

I want to get the list of all databases in Postgresql server in python list. Basically then i want to create those insode another database But i am not able to get it. This is what i have tried ...
0
votes
0answers
15 views

Python 2.7 & Postgresql comparing DB table to CSV and update DB accordingly

I have a Postgresql Database. We will work with the pretend data: cust_id | name | policy_number | special_action | new ...
1
vote
1answer
20 views

Getting error messages from psycopg2 exceptions

This is my first project using psycopg2 extensively. I'm trying to find a way to extract the psql error message for whenever a connection attempt fails. I've tested the code below will work if all the ...
1
vote
0answers
19 views

psycopg2 hangs when “SELECT” statement executed against information_schema on CentOS vs python 2.6

I have a python script that executes query against postgresql database (RedShift. It runs perfectly fine on my local machine: Ubuntu 12.10, python 2.7 psycog.__version__ = '2.5.3 (dt dec pq3 ext)' ...
0
votes
0answers
21 views

Sqlalchemy strange behaviour when inserting multiple rows and returning the primary key

I noticed something strange when inserting multiple rows and returning the primary keys. If I add use the parameter values in the isert query I get the expected behaviour, however when passing the ...
0
votes
2answers
32 views

django form submission error (passing parameter from view.py to form)

I am a beginner to Django and Postgresql, and new to stackoverflow. Currently I am developing a web app that allows the user to create a new postgresql database, as well as connect to a existing ...
1
vote
1answer
15 views

Inconsistent results when exporting JSON from Postgres using Django

I'm trying to create a Django view that returns JSON data from Postgres (i.e. the data from Postgres is already of the JSON type). I use the Django dev server and Postgres in my development ...
0
votes
1answer
11 views

psycopg2 how deal with TypeError: not all arguments converted during string formatting

i have a simple database query by psycopg2 but i do not know why it always show errors here is the code ip ="127.0.0.1" sql="select count(*) from radacct where nasipaddress=%s" cur.execute(sql,ip) ...
0
votes
1answer
29 views

Continue executing INSERT script even on error - PostgreSQL using Python script

I'm trying to make a bulk insert into my PostgreSQL DB using a python script (with psycopg connection). Now, the script has some duplicates on the primary column which makes it abort and rollback the ...
0
votes
1answer
19 views

Extracting blobs from PostgreSQL using Python - “pause” at the beginning

I want to extract blobs from rows, inside individual files - and am using Python code that looks like this: connDB = psycopg2.connect( database=strDbName, user=strUser, password=strPass, ...
0
votes
1answer
23 views

Waiting for a row update or row insertion with sqlalchemy

I have an application that displays the contents of a database that is updates every 5-10 minutes. Loading all the data in the database takes about 5 minutes. Rather than reloading all the data in the ...
1
vote
1answer
15 views

DJANGO: FK field lookups through QuerySet exclude()

Im trying to exclude all objects from a django queryset that have a foreign key in another queryset. I am not having success using exclude() however. Please help. Here is a snippet from the python ...
0
votes
1answer
36 views

SQL : Insert and Update a new column from existing column

Query matching string tags SQL : Insert and Update a new column from existing column I want to insert a new column in my PostGRESQL data, parsing from an existing column. I have a string ...
0
votes
0answers
13 views

How do I drop custom types using SQLAlchemy + PostgreSQL?

I have a script which cleans the database, and this is widely used in our tests. First, we tried to use SQLAlchemy Metadata.drop_all() thing, but it didn't resolve some foreign keys on deletion, ...
0
votes
0answers
25 views

Error when running migrations: sqlalchemy.exc.CompileError: Postgresql ENUM type requires a name

I'm running into this error when I attempt to run upgrade for the first time. It seems to be failing on the gender_types enum, even though I have given it a name attribute. Is there a fix for this? ...
0
votes
0answers
20 views

Bulk upsert (insert-update) a csv in postgres [duplicate]

I'm looking for a good way to bulk "upsert" a csv. The table is: category_id (indexed but not unique) post_id (indexed and unique) a post_id should only be represented once. Is there a good ...
0
votes
0answers
13 views

Connexion to a pg BDD using python script called by php script

I already wrote a python script whish open a DB connexion in Postgres, but when i try to execute it with a php script (by using Apache localhost server), it seems to execute correctly the beginning of ...
0
votes
0answers
13 views

OpenPLM 1.2 does not send mail, how to debug Django sendmail

PostgreSQL 9.1 Python 2.7.3 Django 1.3.1 Celery 2.4.6 Haystack 1.2.7 Xapian 1.2.8 Lepl 5.1.1 South 0.7.3 settings.py DEBUG = True TEMPLATE_DEBUG = DEBUG EMAIL_HOST = 'localhost' EMAIL_PORT = 25 ...
0
votes
1answer
28 views

Django query formatting datetime output

My Django install uses a PostgreSQL backend. I am doing the following in a Django view: completedItems = Completed.objects.filter(user_id=1) return ...
0
votes
1answer
70 views

How to install PL/Python on PostgreSQL 9.3 x64 Windows 7?

I have tried to install the PL/Python v2.x language inside PostgreSQL on my database running the query: CREATE EXTENSION plpythonu; (I got this from ...
0
votes
1answer
24 views

TTL with peewee

I feel a little strange asking this question, but I really have not been able to find an answer after pretty extensive googling. Right now I'm using the peewee ORM on top of PostgresQL and I'm ...
0
votes
1answer
23 views

Can I find and replace a string in an entire postgresql database of a Django project?

I'm looking to find and replace every instance of a certain string within a database that drives a Django project. Is there a way that I can write a management command that searches every table of the ...
0
votes
1answer
35 views

How to integrate customer pole display in point of sale module of openerp

How to integrate customer pole display in point of sale module of openerp? can you tell me how to make connection in between openerp and customer pole display(for point of sale) Your help will be ...
0
votes
1answer
18 views

PostgreSQL and South migrations sequences

I switched from MySQL to PostgreSQL and running migrations and it is a bit strange after MySQL. When I run ./manage.py migrate on a clean db, whenever the migration comes to a field which is ...
0
votes
1answer
42 views

GeoDjango dwithin errors when using django.contrib.gis.measure.D

First off: Python 2.7.6, Django 1.6.5, Postgres 9.3.4, PostGIS 2.1.3, psycopg2 2.5.3 on RHEL 6.5 Here's the relevant model: class Location(models.Model): name = models.CharField(max_length=255) ...
1
vote
0answers
31 views

UTF-8 Error when trying to insert a string into a PostgresQL BYTEA column with SQLAlchemy

I have a column in a PostgresQL table of type BYTEA. The model class defines the column as a LargeBinary field, which the documentation says "The Binary type generates BLOB or BYTEA when tables are ...
0
votes
1answer
11 views

Django: Collecting all entries from a Foreign key model from a specific Parent Model

I am currently using this relationship to grab all images from a specific instance of the model Product product = get_object_or_404(Product, pk=product_id) images = product.image_set.all() If I ...