Tagged Questions
0
votes
1answer
20 views
SSH python library [on hold]
I have a question about a ssh python library.
I plan to use ssh to communication between Windows and Linux environment.
A typical user will be on a Windows environment and will need to access to ...
0
votes
2answers
30 views
Django: How to write query to sort using multiple columns, display via template
I'm quite new to Django, and not too experienced with MVC, DB queries.
I have a Customer table which includes customer_name, city_name, as well as a state_name (pulled from a foreign key table). In ...
0
votes
1answer
22 views
sqlalchemy: cannot save model with Date column
I have created a model via declarative_base:
Base = declarative_base()
class Record(Base):
__tablename__ = 'test'
id = Column(BigInteger, primary_key=True)
datefrom = Column(Date)
...
0
votes
0answers
25 views
How to delete multiple rows with 2 columns as primary key in PostgreSQL?
I'm looking for a solution in Postgres to the following problem:
delete multiple rows in a table with a composite primary key
I found the solution for MySQL here but it doesn't work for Postgres
...
0
votes
1answer
33 views
psycopg2.InterfaceError: connection already closed / pgr_astar
I am using psycopg2 to access a postgresql database from python. When I try to run the pgrouting function "pgr_astar" for the shortest path, I receive an error
cur = db.cursor()
...
0
votes
0answers
17 views
Django with postgresql: auto_increment field starts at 0 after deserialization
On my production postgresql database, in heroku, I've used django deserialization to populate models from json files.
On sqlite this works fine. However on postgresql it seems that all the autofields ...
0
votes
0answers
22 views
how to connect a postgresql database using pyodbc and freetds
I m trying to connect a postgres sql database which is in another ubuntu pc from my ubuntu11.10. But i cant able to connect. I m using Python 2.6 .
ConnDb.py :
import psycopg2.extensions
import sys
...
0
votes
3answers
27 views
Having trouble with a PostgreSQL query
I've got the following two tables:
User
userid | email | phone
1 | [email protected] | 555-555-5555
2 | [email protected] | 555-444-3333
3 | [email protected] | 333-444-1111
4 | [email protected] ...
0
votes
0answers
16 views
Working with pending trigger event in Django 1.4
@transaction.commit_on_success
def action_init_address_receipt(cls, request):
execute_sql('alter table finance_addressreceipts disable trigger user;')
execute_sql('select ...
0
votes
1answer
17 views
Python + psycopg: type '23' for column when in fact 'double precision' in postgresql database
I use psycopg2 in python to access a postgresql database.
I first collect rows with a fetchall:
rows=cur.fetchall()
Then, for each row, I modify the type from postgresql format to python format:
...
0
votes
1answer
20 views
Django HStore: How to override a key-value model field's __getattr__ and __setattr__
I've been getting my feet wet with using hstore in Django, through the django-hstore module. A big advantage to using hstore is that it allows for key-values to be stored in a field while providing ...
0
votes
1answer
29 views
pg.InternalError: SSL SYSCALL error: EOF detected
I have a code in python using multiprocessing and accessing a database. It works most of the time properly but from time to time it creates an error. The error was originally
File ...
1
vote
1answer
25 views
SQLAlchemy + PostgreSQL + PG regex
SA has support for regexes but those seem to be Python regexps (Regular expressions in SQLalchemy queries?)
I need to use regex on matching some rows (a row contains 1 log line, so regex is a natural ...
0
votes
1answer
19 views
Why does django/tastypie with postgresql concatenate models_?
I am using postgresql with django and tastypie. I have my models and resources set up and working with mongodb for certain models and am trying to use postgresql for relational data models. For some ...
0
votes
0answers
37 views
Does a high CPU usage -say 98%- necessary mean the database will be slower? [migrated]
I have 4 python scripts each running in their own virtual machine. The scripts are accessing a central postgresql database. All scripts are reading from the same table but posting to different tables ...
1
vote
2answers
71 views
Mac + virtualenv + pip + postgresql = Error: pg_config executable not found
I was trying to install postgres for a tutorial, but pip gives me error:
pip install psycopg
A snip of error I get:
Error: pg_config executable not found.
Please add the directory containing ...
0
votes
1answer
14 views
SQLAlchemy misses data on query when parameter is datetime.date
I have a Transaction model where one of the fields is
transaction_date = Column('transaction_date',
sa.types.DateTime(timezone=True),
...
1
vote
2answers
43 views
“ProgrammingError: column ”genre_id“ of relation ”music_album“ does not exist” while the column does exist
I have the following models :
class CulturalDocument(CacheMixin, models.Model):
...
uuid = UUIDField(unique=True)
class Genre(CulturalDocument):
name = models.CharField(max_length=32)
...
0
votes
2answers
49 views
pip install psycopg2 venv freezing
So I'm trying to install psycopg2 in a virtualenv so that I can deploy a Django app to Herkou. I ran into a pg_config executable not found error, so I reinstalled PostgreSQL, but this time via ...
0
votes
0answers
37 views
Postgre/SQLAlchemy UUID inserts but failed to compare
I am accessing Postgre database using SQLAlchemy models. In one of models I have Column with UUID type.
id = Column(UUID(as_uuid=True), default=uuid.uuid4(), nullable=False, unique=True)
and it ...
0
votes
1answer
15 views
Why would we need to have multiple search vectors per class? (sqlalchemy-searchable)
I was going through the sqlalchemy-searchable docs and they have provision for multiple search vectors for same class. Why would this be useful?
for example (from the docs)
class Article(Base):
...
0
votes
0answers
32 views
How to create in SQLAlchemy model row with random string when Postgresql is under?
How to create in SQLAlchemy model row with random string when Postgresql is under?
I need to convert from MySQL where I can do like this.
Column(uuid_generator.GUID(), default=uuid.uuid4, ...
0
votes
0answers
22 views
Django tests don't find the postgres extensions
I am running python tests like this.
python manage.py test
.....
[snip]
.....
LINE 1: SELECT (idx([snip])...
^
HINT: No function matches the given name and argument types. You ...
-1
votes
1answer
15 views
Hibernate in python (using socket) [closed]
i'm trying to do a client/server application using python and postgresql.
Is there a kind of framework like hibernate to python?
1
vote
1answer
24 views
Python postgres output formatting
I'm using psycopg2 and I'd like to know if there's a way to generate some cleaner output from my SELECT statements.
My data looks like this in the database:
("Apple" user:(Apple) tag:(Apple))
When ...
1
vote
1answer
24 views
SQL within Django - “order” field for the records in table - defined by user, can be arbitrary, changes constantly - how do I do this?
So I have an application in which a user creates a list. The user also orders the items in the list and can add and remove items from the list. If the user logs out and then logs in from another ...
0
votes
0answers
11 views
DJango creating a model of existing table with bigserial
I'm using DJango 1.6 with python 2.7, I have an existing postgresql+postgis database
the tables declare a column of type bigserial as their primary key
for example:
CREATE TABLE MMCompany
(
...
0
votes
1answer
30 views
DJango 1.6 model.BinaryField causes TypeError
I've created a class model using DJango 1.6 with python 2.7 as follows:
class Company(models.Model):
Name = models.CharField(max_length=150)
PhoneNumber = ...
0
votes
0answers
21 views
COPY FROM error in cqlsh Cassandra newline character seen in unquoted field
I am attempting to import a tab delimited file (or a csv for that matter) using cqlsh into a Cassandra keyspace. In Postgres I would simply use:
copy alaska_chinook (year, count_date, fish_count, ...
0
votes
0answers
68 views
trying to create a simple flask service to connect to postgresql database
newbie to flask & compute engine
I've created a database (myDB) with table user and store procedure insert_user.
now i wish to create a simple python/ flask service that will connect to the ...
0
votes
1answer
26 views
Timing issue (?) between python, bash and psql
I use Pythons os.system, pg_dump and psql to transfer data between Postgresql databases. The command is execute like this:
os.system('set some variables ; pg_dump ... | psql ...')
... process copied ...
0
votes
0answers
26 views
Django postgresql on Heroku DatabaseError value too long for type character varying(1000)
I'm getting this error when saving a Django Model Object:
DatabaseError: value too long for type character varying(1000)
Inside the model there is a textfield:
models.TextField()
I'm saving ...
0
votes
1answer
41 views
Error when attempting to install django-toolkit within a python virtualenv
I'm relatively new to Python, extremely new to Django and Heroku, and also rather new to working in the terminal.
I'm attempting to follow the instructions on setting up a Django Heroku project found ...
1
vote
1answer
28 views
Unable to acquire db connection from Trac?
Attempting to install Apache Bloodhound (which is built atop Trac) on Ubuntu 13.10 x64 server.
I have followed their installation guide precisely (for Postgres).
Error output from ...
0
votes
1answer
43 views
How to union two subqueries in SQLAlchemy and postgresql
Raw SQL desired:
SELECT
id
FROM
(SELECT some_table.id FROM some_table WHERE some_table.some_field IS NULL) AS subq1
UNION
(SELECT some_table.id WHERE some_table.some_field IS NOT NULL)
...
0
votes
2answers
38 views
Psycopg2 Full Outer Join with Python 2.6
I am brand new to using psycopg2 to interact with a postgreSQL database. I am attempting to do a full outer join and cannot find any documentation to help me with the command. Here is what I am ...
1
vote
2answers
113 views
+50
How to show database errors to user in Django Admin
Background: my Django application sits onto top of a pre-existing Postgresql database. This database has a very complex network of triggers and constraints.
Question: In the Django Admin, if a user ...
1
vote
1answer
34 views
GeoDjango touches function is slow
First off, here's my setup:
Python 2.7.6
Django 1.6
PostgreSQL 9.3.1
PostGIS 2.1.1
I have loaded up the Natural Earth countries and states datasets into PostGIS. Here's the Django model I'm using:
...
1
vote
1answer
159 views
Storing the Uploaded image?
I am using a basic WTForms FileField so far i am able to upload the file but its not getting stored in directories but its getting stored in POSTGRESQL database as <Binary data>. How to store ...
1
vote
1answer
52 views
Should I do numerical calculations in-database?
I have a database containing results from many models I've run. I need to calculate each model's chi^2 value. I'm using python and the
psycopg2 package to interface with my PostgreSQL database. ...
0
votes
1answer
29 views
Soaplib connection - msg 's0:FunctionName', not-found
I have problem with solution that was working very good and suddenly it stopped to do so. I wrote server/client scripts and modules to make a SOAP connection type for my application.
Here is my server ...
0
votes
1answer
35 views
Query that excludes rows in a certain table
I have three tables: users, contacts, and groups. I want to find all the contacts of a user, and then from those selected contacts, I want to exclude those contacts of that user that have a particular ...
0
votes
2answers
32 views
os.system with embedded commands
I've now been struggling a long time and still can't get this line of code working :
os.system('su - postgres -c "psql -c \'ALTER USER postgres WITH ENCRYPTED PASSWORD ...
0
votes
1answer
22 views
AttributeError: get_tables
What is the problem of this code? Should show a list of tables
import pg
con = pg.connect(dbname='xxx', host='xxxx', user='xxx')
pgqueryset = con.get_tables()
Traceback (most recent call last):
...
0
votes
2answers
55 views
Remote CSV import Postgres
What is the best way to automatically import CSVs into a remote Postgres server?
I am using a temperature sensor connected to my raspberry Pi to log data (using a python script) into a CSV file:
...
0
votes
1answer
51 views
Difficulty opening port 5432 for PostgreSQL on Ubuntu 12.04
I'm trying to get a postgres database talking to a django installation.
I've followed the steps details here: http://blog.iiilx.com/programming/how-to-install-postgres-on-ubuntu-for-django/
However, ...
0
votes
0answers
74 views
Django (postgresql-psycopg2) connection pool: Simple vs Threaded vs Persistent ConnectionPool
I was looking at db connection pool implementations to use in my Django app using postgresql db backend, and came across this very recent wrapper package implemented for psycopg2 -
...
0
votes
1answer
104 views
Django unable to load test fixtures, IntegrityError
I'm using Saleor/Satchless to power and e-commerce site (inherited the project). I couldn't find a Saleor mailing list so posting here instead.
I dumped the DB to create some test fixtures.
...
0
votes
0answers
30 views
Django admin default ordering of custom fields
I have the following django admin exceprt:
class TagAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("title",)}
list_display = ['title', 'total_videos', 'total_active_videos', 'weight', ...
0
votes
0answers
48 views
psycopg2 DatabseError could not receive data from sever: Software caused connection abort
I use the psycopg2 package to receive data from the sever. The data have more than 500 thousand rows. The error occurs at the 492349 rows. Why?
I googled this question and find the similar question ...