Tagged Questions
0
votes
0answers
10 views
Can Sqlalchemy work well with multiple attached SQLite database files?
It's possible to connect multiple SQLite databases together using the 'ATTACH' statement and work with them jointly. Tables in each SQLite file can be referenced using a schema/file specific keyword. ...
0
votes
3answers
29 views
Efficient way to use filter() twice in Django
I am relatively new to Django and Python, but I have not been able to quite figure this one out.
I essentially want to query the database using filter for a large number of users. Then I want to make ...
0
votes
1answer
17 views
SQLAlchemy: update from_select
I need to execute query like
UPDATE node
SET node.parent_id = node_node.parent_id,
node.label = node_node.label
FROM node_node
WHERE node_node.child_id = node_id
using SQLAlchemy. I did search ...
0
votes
0answers
25 views
how to implement a search function for a field of type many2one?
im trying to implement a simple search function in open erp 7. It will search and list all records based on management code, but the problem is management code is a type many2one and its a field in ...
0
votes
2answers
16 views
Does SQLAlchemy support UPDATE…FROM syntax for postgres?
I want to write a query like so with SQLAlchemy:
UPDATE mytable
SET
mytext = myvalues.mytext,
myint = myvalues.myint
FROM (
VALUES
(1, 'textA', 99),
(2, 'textB', 88),
...
) AS ...
0
votes
1answer
31 views
postgres - getting data by distinct targets and averaging - no luck so far
Main Question: "What is the average temperature of all my sensors currently? What is the average angle? average db level?"
So I have a python script that loops every 15 minutes that populates a ...
0
votes
0answers
23 views
How to implement a newsfeed in python/postgres [on hold]
I'm implementing a social website using Python and Postgres. The plan is to have lots of users adding and updating items on the site, maybe thousands per minute (wish me luck!).
Now these new items ...
0
votes
1answer
13 views
Postgres FATAL database does not exist Django
I have seen many of these questions asked for Ruby but not for DJango. We have a postgres DB and created a table name Adam with our postgres user. When you psql -l the table shows up. However, when ...
2
votes
1answer
25 views
Restore a PostgreSQL database without setting the password in the enviroment
I need to make a script in python that calls pg_restore to restore a database. So far I use a batch file that sets true password in PGPASSWORD and after the restore it sets garbage in the var.
My ...
1
vote
1answer
24 views
Django model PostgreSQL equivalent Django ORM command
I have a PostgreSQL table with columns that have repeating data like this which was created using a django model:
In order to get distinct values of a column, we use a Postgres command something ...
1
vote
1answer
26 views
Getting distinct columns from postgresql in django model
I have a postgresql table with columns that have repeating data like this which was created using a django model:
In order to get distinct values of a column, we use a postgre command something ...
0
votes
1answer
25 views
Postgresql prompts for password from command-line despite finding it in .pgpass
I am trying to connect to a psql server remotely from within a python script. Despite the fact that I have set .pgpass properly, when I run the script the remote server prompts for password, in which ...
0
votes
1answer
21 views
Python mod_wsgi database connection not working
I've installed Postgres, mod_wsgi and python3.5 on a centos system. I've tested the connection and it works fine both in the interactive Python shell as well as the development application (it's a ...
1
vote
0answers
30 views
Filtering a json type in a django model
I have a JSON field in a PostgreSQL 9.3 database. I'd like to be able to access it through a Django model. I've taken a look at django-jsonfield and jsonfield; however these do little besides ...
0
votes
0answers
22 views
how to save django queryset results in a text file?
How do I save the results of Django queryset in a file?
In Linux I can do this like
sudo -i -u postgres psql db_name -c "SELECT * from table_name" > out.txt
How can I do the similar thing in ...
0
votes
2answers
17 views
Alembic migration stuck with postgresql?
I wrote a migration script which works fine on sqlite, but if i try to apply the same to postgres it is stuck forever.
With a simple ps i can see the postres stuck on "create table waiting".
There are ...
0
votes
0answers
19 views
“Sometimes” getting an InterfaceError on PostgreSQL with Peewee ORM
I'm building a website using the Python Flask framework and the Peewee ORM with PostgreSQL 9.3. So far things are going pretty well, but I now run into some trouble. I sometimes get an InterfaceError: ...
0
votes
1answer
24 views
Django: “Can't convert 'Name' object to str implicitly” on saving object
In Django admin, I have created a Name object with name: "United Kingdom". I then create a Nation object with the Name object I've just created, and a path to a flag image.
On saving the entry, I ...
0
votes
1answer
23 views
Sqlalchemy create a database table manually
Is there a way to create a table without using Base.metadata.create_all(). I'm looking for something like Mytable.create() which should create only its corresponding table.
The reason I want to do so ...
-7
votes
0answers
44 views
Saving only latest 1000 record on the postgres database [closed]
i have a Postgres database that i want saves only 1000 record. right now there is no any mechanism for it and it saves all of requests. how i can do this? i want to have latest 1000 record every time! ...
1
vote
1answer
23 views
How to check if pyodbc is already installed on my MacOS?
Is there any way to check if pyodbc is already installed in my MacOS (10.9)? I already had python 2.7 installed on my mac and in addition I installed python3 later. Now both version of the python ...
0
votes
1answer
17 views
sqlalchemy column named user, inconsistency
I am intefacing a postgresql database via sqlalchemy (python).
In there I have a talbe like this:
SELECT * from mytable;
id | user | password | host | port
...
0
votes
2answers
26 views
Inserting data in postgres using a python list
I want to enter a python list into an insert query and enter data into postgres, I am using executemany but still getting an error "TypeError: not all arguments converted during string formatting"
...
0
votes
1answer
19 views
Query a PostgreSQL character varying column by parts of the string
Background: We are pulling hundreds of excel documents using python and xlrd module and putting those results into a Postgres 8.4 database. The problem is excel stores date time as a crazy floating ...
0
votes
1answer
44 views
How to import large XML/JSON dataset into Django/Postgres app/database?
We have a large Filemaker database that and have written a tool that exports all the required information into XML/JSON.
We've created a Django App with the Django REST Framework and set up our model ...
0
votes
2answers
55 views
Django admin database not updating properly after admin input
I'm having an issue where if I delete a Product in the admin page all of the URLS created by the template that link to the remaining products don't work anymore and every page gives the error "No ...
0
votes
1answer
25 views
How to execute sql lines in postgresql using python?
I use postgresql 8.4 to route a river network, the following is my code typed in pgAdmin and the result is fine,
select * from driving_distance
('select gid as id,
start_id::int4 as source, ...
1
vote
1answer
48 views
Installing psycopg2 using Flask/Postgres
I've been searching all night for a solution to this, but I seem to be running into an uncommon error while trying to install psycopg2 in a virtualenv on a Flask application. I run this command:
...
0
votes
0answers
33 views
Why am I getting an error message when trying to run manage.py?
Getting a list of errors in cmd prompt (Windows 8) when trying to run manage.py.
I am trying to follow this tutorial: http://wiki.thinkhole.org/howto:django_on_windows/
I am a little less than half ...
0
votes
1answer
29 views
openERP 7 need to export data in UTF-8 CSV , but how?
I can export a CSV with openERP 7 , but it is encoded in ANSI. I would like to have it as a UTF-8 encoded file. How can I achieve this ? The default export option in openERP doesn"t have any extra ...
0
votes
2answers
46 views
Django 1.5: How do I add a new model field to an existing table using South without having to drop a table?
I am running a Django 5.1 web application live on Heroku, with user data I want to preserve.
Locally, I just added a new char field to an existing model, and don't want to break anything when I push ...
0
votes
1answer
15 views
sqlalchemy session execute messes up valid postgres syntax
I have an application that needs to interact with a database through use of good old fashioned models as well as generated sql.
Session = sessionmaker(bind=engine)()
cmd = """insert into ...
1
vote
1answer
37 views
Can't get Django/Postgres app settings working on Heroku
I'm making a Django app with the Two Scoops of Django template. Getting this Heroku error, are my Postgres production settings off?
OperationalError at /
could not connect to server: Connection ...
1
vote
2answers
54 views
Database engine choice for Django/ Python application [closed]
I am working on a Python/Django application. The core logic rests in a Python application, and the web UI is taken care of by Django. I am planning on using ZMQ for communication between the core and ...
0
votes
1answer
30 views
Database saves multiple choice as [u'abc', u'cba']
How can I prevent the postgreSQL database to save a multiple select as [u'abc', u'cba']? The field type is "text".
When displaying the entries on a website I want to show: abc, cba.
0
votes
1answer
23 views
PostgreSQL FDW extension Multicorn - “Error in python: ImportError”
I'm trying to install Multicorn extension on PostgreSQL 9.3.3, but the problem I have that this extension only works with Python 2.7 or 3.3 whereas default version of python on my OS (Centos 6.5) is ...
0
votes
0answers
13 views
How to add django orm inherited property fields to postgres full text search djorm_pgfulltext fields attribute?
I have a django 1.4 project with ORM model classes that inherit a property of the base model class. I am using postgres full text search using djorm_ext_pgfulltext to search the fields in the derived ...
0
votes
0answers
40 views
How to copy files to CitusDB PostgreSQL
A CitusDB cluster is built, 1 master node and 2 worker nodes. Now I am using my_postgres.py script to load data from a csv file to PostgreSQL database and it shows the following error:
...
1
vote
1answer
27 views
How to change python version in makefile - compiling Multicorn (PostgreSQL FDW extension)
I'm trying to install PostgreSQL extension Multicorn on CentOS 6.5. The problem that I have though is that default version of python on Centos is 2.6 and Multicorn requires 2.7 or 3.3. I'm trying to ...
0
votes
0answers
26 views
How to optmimally compute cross-model statistics using django and rest framework?
I am working on a database for a (real life) library, which delivers .json files with pagination through REST framework to frontend, so backend queries are quite frequent - on every page change.
I ...
0
votes
2answers
86 views
Distance between several latlng with Google maps API
If I have stored in my DB several latlng points, and I want to compare those points with my actual latlng position( giving me the distance between each latlng points with my actual latlng), how would ...
-1
votes
0answers
26 views
find records in postgresql using pyqt and python
I'm developing a program using PyQt, Python and PostgreSQL.
I'm using qline edit for entering the search string. With this code I search over the databases for the record. Everything works fine until ...
0
votes
1answer
36 views
How to install app on heroku with postgres
I am trying to install an app in Heroku cloud. This python based app is built on postgresql. I have set up this app in my local machine(Ubuntu). I have following queries.
How to install postgresql ...
1
vote
0answers
16 views
Django overwrite existing db backend
I am using Python 2.7.5, Django 1.5.4 and PostgreSQL 9.3. I have a INET field in my model object. The field definition is like;
class INETField(_NetAddressField):
description = "PostgreSQL INET ...
0
votes
2answers
21 views
How to determine a number of queries SQLAlchemy does during user request?
I searched the internet and didn't find an answer to a very simple question.
I have a simple web application (powered by web.py) which uses SQLAlchemy 0.7.8 + psycopg2, so sqltap doesn't work for me. ...
0
votes
1answer
35 views
Django: Accessing user profile data in another app
I am currently working on a django application and I am trying to develop a little recommendation system for it. I already extended the User model and made a user profile in an app called profile like ...
0
votes
1answer
30 views
Django … Sum up a calculation from a database
The postgres table has an entry for each job executed on one of the compute clusters. Included in the table are fields for the job epoch starting time (g_start_time), the job epoch ending time, the ...
0
votes
0answers
11 views
Is the manage.py loaddata command in django 1.4 idempotent?
I am using django 1.4 with the manage.py loaddata command.
Is this command idempotent with respect to the underlying database?
0
votes
0answers
46 views
Connect to OpenErp XML-RPC service from Django
Is there any clear tutorial or method i could read to achieve a connection to my openerp instance from django?
I've searched and searched, and yes, there is the django xml-rpc module but i can't find ...
0
votes
1answer
28 views
Django/Postgresql memory leak and persistent connections
I'm seeing the memory utilization of some postgres processes growing up to 25% over time. The postgres connection is established by django which in turn is mostly just creating new records.
I'd like ...