0
votes
1answer
17 views
How to check if PostgreSQL schema exists using SQLAlchemy?
I am using SQLAlchemy to generate tables in a specific schema in a PostgreSQL database. If the schema does not exist, I want to create it. I know the PostgreSQL query to check for the existence of the ...
0
votes
2answers
39 views
TypeError: 'int' object does not support indexing
I have this query:
some_id = 1
cursor.execute('
SELECT "Indicator"."indicator"
FROM "Indicator"
WHERE "Indicator"."some_id" = %s;', some_id)
I get the following error:
TypeError: ...
1
vote
1answer
24 views
Inserting multiple strings into 1 table
I am trying to add 2 strings into a table.
My insert statement is:
INSERT INTO "State"
(state, relevant_id)
VALUES (%s, %s) """, state_values, relevant_id
This does not work ...
2
votes
2answers
41 views
Complex program escaping
I have a fabfile that I would like to run a command to create a postgres database.
The SQL request is:
CREATE DATABASE "dbname"
WITH ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF8'
LC_CTYPE = ...
1
vote
1answer
37 views
Python threading with Postgres: things are not being updated properly
I have a thread that runs independently
thread.start_new_thread(listeningTF2Servers, ())
which calls up this method eventually:
def updateStats():
...
for player in ...
1
vote
0answers
32 views
Incomplete output with psycopg2 and csv writer in python
I wrote the following python code that would write a portion of a postgresql table to a csv file using psycopg2 and python's csvwriter. The problem that I am having is that I get an incomplete csv ...
1
vote
1answer
37 views
Escape input data for postgres
I writing a python script for inserting of data in my postgres db.
Is in postgres a escape function how I can escape the inserted data?
0
votes
1answer
26 views
Lines Functional values how to shows before saving the record
Openerp 7 based on this requirement Sale order lines Remaining days Calculate Start Date minus Today at all times. Functional Field and on_change function used:-
def _remaining_days(self, cr, uid, ...
1
vote
1answer
26 views
Failed to insert into postgresql table
I am using this to create table:
dbconn=psycopg2.connect("dbname='postgres' host='localhost' port='5432' user='postgres' password='123456'")
cur=dbconn.cursor()
cur.execute("""
CREATE TABLE Person
(
...
0
votes
2answers
60 views
Best method for repeated searches on large list of dicts
Let's say I have a function that returns 1000 records from a postgres database as a list of dicts that looks like this (but much bigger):
[ {"thing_id" : 245, "thing_title" : "Thing title", ...
0
votes
1answer
34 views
Storing locations in hierarchy - How to overcome?
This is my schema for storing locations:
CREATE TABLE locality (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR (100) NOT NULL UNIQUE,
loc VARCHAR (17) NOT NULL,
rad VARCHAR (17)
);
CREATE ...
0
votes
1answer
68 views
+50
How to use python 32bit under osx with Aptana studio
Following this thread: Psycopg2 under osx works on commandline but fails in Aptana studio
I have the exact same issue.
I couldnt find/understand how to use 32 bit python in Aptana.
Running the same ...
0
votes
2answers
23 views
Django ORM - partial match of rows in different tables
I have two different Django models, "modelA" and "modelB", who only have two columns in common with each other: "EMAIL" and "NAME", with the rest of the columns in each model being different. I want ...
0
votes
2answers
42 views
Postgresql: “database does not exist”
Following the postgresql installation instructions for Mac, I recently created a db and launched the server. Everything looks like it's working fine.
/opt/local/lib/postgresql93/bin/postgres -D ...
0
votes
1answer
37 views
How do I connect to Postgresql server from Python?
My final goal is to setup a server on my raspberry pi which can connect to a local postgresql server.
Im a bit familiar with postgres therefore I installed it on my raspberry pi immediately.
however, ...