0
votes
1answer
17 views

cannot insert None value in postgres using psycopg2

I have a database(postgresql) with more than 100 columns and rows. Some cells in the table are empty,I am using python for scripting so None value is placed in empty cells but it shows the following ...
0
votes
0answers
25 views

Long chained exists query with multiple one-to-many mappings in the chain

Edit: Following piece seems to be the right way: session.query(User).join("userGadgets", "gadget", "components","gadgetComponentMetals") Original: I have the following tables configured: class ...
0
votes
0answers
16 views

Flask/Peewee doesn't work with PostgreSQL on Heroku

I have written a flask/peewee app and it works on my local machine with sqlite. I have changed the database to postgresql and deployed it on heroku, but then I seem to be getting a problem with the DB ...
-1
votes
2answers
18 views

Which web frameworks alternatives (need support for templates, postgreSQL, taxonomy driven content) [on hold]

What are my alternatives for a web framework, fast, secure, with native support for templates, postgreSQL, and taxonomy driven content? Preferably Python, definitely not PHP, ideally not NodeJS ...
0
votes
0answers
16 views

johnny-cache django 1.3.1 with postgresql view: slow view is not being cached

Doing maintenance on a django 1.3.1 app. We took over from a different company. In the settings.py file, I just discovered the following code: # Models based on PostgreSQL views don't get their ...
1
vote
1answer
26 views

django postgresql query not working

I have a postgreSQL database that has a table foo that I've created outside of django. I used manage.py inspectdb to build the model for table foo for me. This technique worked fine when I was using ...
0
votes
2answers
13 views

query from postgresql using python as dictionary

I'm using Python 2.7 and postgresql 9.1. Trying to get dictionary from query, I've tried the code as described here: http://wiki.postgresql.org/wiki/Using_psycopg2_with_PostgreSQL import psycopg2 ...
0
votes
1answer
19 views

django south : “No connection could be made because the target machine actively refused it.”

I am developing on win7 with pycharm 3 with python/django on a portable environment. I've decided to try to add postgresql to my project ("rob1") which is inside my virtualenv "R1" and I have using ...
0
votes
1answer
24 views

Postgres: test insert or update before doing it?

We have a table that only ever contains one entry of a particular type, so if we get an request for an insert we delete everything and then do the insert. The insert comes from user data and there ...
1
vote
1answer
42 views

“settings.DATABASES is improperly configured” with django 1.6

I am developing on win7 with pycharm 3 with python/django on a portable environment. I've decided to try to add postgresql to my project ("rob1") which is inside my virtualenv "R1" and I have using ...
0
votes
0answers
35 views

Safe relational query language for public use via the API

I'm developing an API which, among other features, provides CRUD access to the PostgreSQL storage. I need to expose some SQL features such as: Projection (pick/omit fields in the result set) ...
0
votes
2answers
30 views

Encryption using Python and PostgreSQL

We have a database that contains personally-identifying information (PII) that needs to be encrypted. From the Python side, I can use PyCrypto to encrypt data using AES-256 and a variable salt; this ...
0
votes
1answer
35 views

Correct Postgresql syntax

I'm a postgres newbie and am having some issues querying a text field in postgresql using Python. What is the correct syntax that will allow me to search the content of column "body" from table ...
1
vote
3answers
32 views

How to receive automatic notifications about changes in tables?

What I am using: PostgreSQL and Python. I am using Python to access PostgreSQL What I need: Receive a automatic notification, on Python, if anyone records something on a specific table on database. ...
2
votes
2answers
72 views

Updating json field in Postgres

Querying Postgres 9.3 by json field is really great. However i couldn't find a formal way to update the json object, for which i use an internal function written in plpythonu based on previous post ...
0
votes
0answers
33 views

Storing UTC timestamps in Postgresql to later be displayed with AngularJS

I have read quite a bit on storing timestamps in UTC and keeping the timestamps in UTC until the last possible moment (i.e. when it is displayed to the user in the browser). However, I am still a ...
3
votes
1answer
74 views

'ascii' codec can't decode byte 0xe2 in position 5367: ordinal not in range(128)

Django 1.6.1 Python 3.2.3 Apache 2.2.2 Ubuntu 12.04 Postgres 9.1.11 I'm getting this error when trying to import a serialized XML file. I exported it from one database that I was using for a ...
0
votes
0answers
12 views

How can i create the shapefile in python from postgres on Linux [closed]

I am using Centos and i have the postgres postgis databse with spatial data. Now i want to create the python script which can create the shape from from the data in posgres table. How can i do that. ...
0
votes
1answer
50 views

How to find pg_config path

Complete newbie here, trying to set up Django to work with ProstgreSQL. I'm using mac osx 10.6.8. I have also installed PostgreSQL 9.3 When I run pip install psycopg2 in terminal I get the ...
0
votes
2answers
48 views

error: Unable to find vcvarsall.bat in installing psycopg2 in windows7

Im using Windows 7 for developing Django 1.3.7 using PostgreSQL 9.3 as database. on my settings.py I set DATABASE_ENGINE = 'django.db.backends.postgresql_psycopg2' but when I try to execute python ...
1
vote
0answers
28 views

How can I compare SQLAlchemy UTC dates in the user's timezone?

I'm trying to fetch events to display on a calendar in the user's local time. All dates are stored in Postgres as UTC. Here's the Event model and the query in question, from datetime import ...
1
vote
0answers
71 views

How to prevent Server Down

Please help me on this problem. I'm using OpenERP 6.0. The case is like this: I have login GTK client with 2 users. At the same time, I using this 2 users to print the same report (ex: abc ...
0
votes
1answer
37 views

Why sqlalchemy add \ to " for a perfect JSON string to postgresql json field?

SQLAlchemy 0.9 added built-in support for the JSON data type of PostgreSQL. But when I defined an object mapper which has a JSON field and set its value to a perfect JSON string: json = ...
0
votes
0answers
22 views

Can't install psycopg2 on Maverick

I am trying to install psycopg2 on Mac OS X Mavericks but it doesn't see any pg_config file. Postgres was installed via Postgres.app . I found pg_config in ...
0
votes
0answers
30 views

Django cannot flush database because of constraints

I am trying to flush (reset) the database of the postgres database of my app to create test-fixtures. When running python manage.py flush I am confronted with the following error: > importing ...
0
votes
2answers
25 views

How to convert sql varchar array to Python list?

I'm using psycopg2 for interacting with PostgreSQL database in Python2.7. psycopg2 saves list in database at first in varchar field, and then I need simply to get the same Python list back. Insert: ...
1
vote
1answer
30 views

DecimalField Converts Zero to 0E-10

Django 1.6, Python 2.7.5+, PostgreSQL 9.1, Linux. I have several decimal fields defined in the model like this: min_inclusive = models.DecimalField(_('minimum inclusive'), max_digits=19, ...
0
votes
0answers
31 views

Automatic PostgreSQL CREATE TABLE and INSERT from CSV or Pandas DataFrame

Does anyone know of some Python package or function that can upload a Pandas DataFrame (or simply a .csv) to a PostgreSQL table, even if the table doesn't yet exist? (i.e. it runs a CREATE TABLE ...
2
votes
1answer
42 views

Cannot complete Flask-Migration

I've setup a local Postgres DB with SQLAlchemy and cannot commit my first entry. I keep on getting this error... ProgrammingError: (ProgrammingError) relation "user" does not exist LINE 1: INSERT ...
0
votes
0answers
32 views

Django unit testing fails with postgres

I have the following problem. I have a bunch of unit tests that all passed when I was running sqlite3 and fail now that I'm using postgres. However, I only get fails if I run all the tests together. ...
0
votes
1answer
110 views

Installing modules in openerp 7 using postgresql 9.3 via pgpool2

I am trying to use pgpool2 and postgresql 9.3 with openerp 7.Initial database get installed but some default modules could not get installed .My problem is that I am getting following error while ...
0
votes
1answer
25 views

SQLAlchemy: Any constraint to check one of the two columns is not null?

This may be totally stupid thing to ask but I have such a requirement in my model where atleast either category or parent_category is not null My model looks like class BudgetCategories(db.Model): ...
0
votes
1answer
15 views

psycopg2 INSERT INTO execute not returning result

I am inserting an item the usual way using cursor's execute. However, doing a cursor.fetchone() afterwards throws a ProgrammaticError saying no results could be fetched. I can see the item inserted ...
2
votes
1answer
24 views

Tables created with Peewee seem to disappear into thin air

I'm currently writing a flask app using the peewee orm for postgresql. It's worked fine in the past, but it seems like something has been thrown into disarray and I'm unclear on how exactly to proceed ...
0
votes
1answer
30 views

What's the Recommended Way to Run CREATE EXTENSION With Salt Stack? [closed]

I'm using Salt Stack to manage my Linux servers. I have a command that creates my PostgreSQL database, but I need to run "CREATE EXTENSION postgis;" on my database. I know I can do this with a shell ...
2
votes
1answer
100 views

update records on table with millions record

We have table of 9 columns and pk is indexed. we have 169.3 Millions records which could go up to 250M. Every time I receive update I have to fetch about 40,000 rows from database to compare using ...
0
votes
1answer
36 views

Dynamically handling data columns in csv for import to Postgresql

I'm new to python (3) and having a hard time with finding relevant examples for how to handle the following scenario. I know this is on the verge of being a "what's best" question, but hopefully there ...
0
votes
1answer
31 views

Postgres Dump is strucked in eclipse, language used is python

Please refer below python code, and let me know what wrong or what need to be done to make it work. The problem i faced is, Eclipse get strucked and backup file is empty. import os import ...
3
votes
1answer
34 views

Parameters ? not working with python postgres

I am using python with postgres and i am trying this simple query but its not working and i am not able to find why con = psycopg2.connect(**config) self.cursor.execute("INSERT INTO mytable (id, ...
0
votes
1answer
15 views

Getting Attribute error with Python and Cursor

I am using this posgres , python with cursor. This is my code class User(): def __init__(self, config): self.con = psycopg2.connect(**config) self.cursor = self.con.cursor ...
0
votes
2answers
51 views

How to create tables for flask app using peewee orm without double quotes in postgresql

I'm new to peewee orm. Peewee uses double quotes when creating tables making it unnecessarily difficult to do select statements through psql shell. This goes for django's orm as well. What I really ...
-1
votes
2answers
72 views

Read From Microsoft Excel (.xlsx) file and Insert into a DB using Python? [closed]

I'm working on an application to read an .xlsx, (Excel File) with headers and insert the rows, as-is, into a DB Table in a Postgres DB. I presume i would be using the XLRD library. Any ideas on ...
1
vote
1answer
60 views

unable to create autoincrementing primary key with flask-sqlalchemy

I want my model's primary key to be an autoincrementing integer. Here is how my model looks like class Region(db.Model): __tablename__ = 'regions' id = db.Column(db.Integer, primary_key=True, ...
1
vote
2answers
53 views

How can in insert tuple data with python in postgres

I have the header dict as this header= { 'catA' : { 'name': 'user_name', 'age':'user_age' }, 'catB' : { 'name': 'person_name', 'age': 'person_age' } } The postgres table is flat with all columns ...
0
votes
1answer
20 views

South does not register ID column

I converted an existing Django app to use South. I needed to add an ID column to one of the models, so I added id = models.AutoField(primary_key=True) to the model. But when I run: python manage.py ...
0
votes
1answer
34 views

django,split the query parameter and pass the value in IN cluase

i have written a native sql query in django, now i need to pass filter condition in where clause. i am passing the URL as list of values like (a,b,c,d) and in database i need to compare and these ...
0
votes
1answer
57 views

Self-referential class: How to get jerarchical structure of employees in a company?

I have a class defined in Python called Employees. Its attribute id_supervisor is the id of the employee who is in charge of him. One employee can be in charge of (supervise) many other employees. ...
0
votes
0answers
24 views

PostgreSQL Update with SQLAlchemy ORM not working [duplicate]

I'm performing an update on a row in a PostgreSQL db via SQLAlchemy ORM in Python using the following: def update_func(session, db, record, *args, **kwargs): query = ...
1
vote
0answers
12 views

Prevent SQLAlchemy from changing fields on associations with two-column foreign keys

I'm using SQLAlchemy 0.8.4 with PostgreSQL 9.2. I've got three simple models: Account, Address, and CreditCard. Both Address and CreditCard have a required Account association. Address has an ...
0
votes
1answer
72 views

SQLAlchemy create_all() does not create tables

I'm trying to integrate PostgreSQL and SQLAlchemy but SQLAlchemy.create_all() is not creating any tables from my models. My code: from flask import Flask from flask.ext.sqlalchemy import ...

15 30 50 per page