Tagged Questions
28
votes
5answers
14k views
Django persistent database connection
I'm using django with apache and mod_wsgi and PostgreSQL (all on same host), and I need to handle a lot of simple dynamic page requests (hundreds per second). I faced with problem that the bottleneck ...
24
votes
7answers
4k views
What is your favorite solution for managing database migrations in django?
I quite like Rails' database migration management system. It is not 100% perfect, but it does the trick. Django does not ship with such a database migration system (yet?) but there are a number of ...
12
votes
3answers
11k views
Importing a CSV file into a sqlite3 database table using Python
I have a CSV file and I want to bulk-import this file into my sqlite3 database using Python. the command is ".import .....". but it seems that it cannot work like this. Can anyone give me an example ...
19
votes
3answers
19k views
Django: QuerySet order by method
Let's say I have the following model:
class Contest:
title = models.CharField( max_length = 200 )
description = models.TextField()
class Image:
title = models.CharField( max_length = 200 ...
17
votes
8answers
11k views
SQLite Performance Benchmark — why is :memory: so slow…only 1.5X as fast as disk?
Why is :memory: in sqlite so slow?
I've been trying to see if there are any performance improvements gained by using in-memory sqlite vs. disk based sqlite. Basically I'd like to trade startup time ...
15
votes
6answers
3k views
How to implement “autoincrement” on Google AppEngine
I have to label something in a "strong monotone increasing" fashion. Be it Invoice Numbers, shipping label numbers or the like.
A number MUST NOT BE used twice
Every number SHOULD BE used when ...
26
votes
4answers
13k views
In Python, after I INSERT Into mysqldb, how do I get the “id”?
The primary key.
cursor.execute("INSERT INTO mytable(height) VALUES(%s)",(height))
My table has 2 columns:
id << primary, auto increment
height << this is the other column.
How do I ...
16
votes
4answers
7k views
SQLAlchemy and django, is it production ready?
Has anyone used SQLAlchemy in addition to Django's ORM?
I'd like to use Django's ORM for object manipulation and SQLalchemy for complex queries (like those that require left outer joins).
Is it ...
10
votes
3answers
5k views
How do I do database transactions with psycopg2/python db api?
Im fiddling with psycopg2 , and while there's a .commit() and .rollback() there's no .begin() or similar to start a transaction , or so it seems ?
I'd expect to be able to do
db.begin() # possible ...
10
votes
3answers
1k views
In Django, how do I select 100 random records from the database?
myqueryset = Content.objects.filter(random 100)
43
votes
14answers
8k views
Which key value store is the most promising/stable?
I'm looking to start using a key/value store for some side projects (mostly as a learning experience), but so many have popped up in the recent past that I've got no idea where to begin. Just listing ...
18
votes
7answers
4k views
Atomic operations in Django?
I'm trying to implement (what I think is) a pretty simple data model for a counter:
class VisitorDayTypeCounter(models.Model):
visitType = models.CharField(max_length=60)
visitDate = ...
19
votes
3answers
3k views
Twisted + SQLAlchemy and the best way to do it
So I'm writing yet another Twisted based daemon. It'll have an xmlrpc interface as usual so I can easily communicate with it and have other processes interchange data with it as needed.
This daemon ...
7
votes
2answers
2k views
variable table name in sqlite
Question: Is it possible to use a variable as your table name w/o having to use string constructors to do so?
Info:
I'm working on a project right now that catalogs data from a star simulation of ...
4
votes
3answers
2k views
Postgres - how to return rows with 0 count for missing data?
I have unevenly distributed data(wrt date) for a few years (2003-2008). I want to query data for a given set of start and end date, grouping the data by any of the supported intervals (day, week, ...