So I have a Django model that stores 5 days worth of data in it because the amount of data is so large we must delete all data older than 5 days. The model currently has the auto incremented id field that Django creates automatically. The problem here is that pretty soon it won't be able to generate primary keys large enough.
Ideally, I'd have a composite primary key, but Django doesn't support this yet. So I was looking at unique_together and wondering if it was possible to just use that as a pesudo pk and remove the auto incrementing id because its not really used for anything in the application.
Another option is this module: django-compositekey but I'm not to sure how well its supported?
In either case the I would need to combine 4 columns to make a unique record:
class MassObservations(models.Model):
time = models.DateTimeField()
star = models.ForeignKey('Stars')
property = models.ForeignKey('Properties')
observatories = (('1', 'London'),
('2', 'China'),
('3', 'United States'))
station = models.CharField(max_length=2, choices=observatories)
mass = models.FloatField()
class Meta:
unique_together = ('time', 'star', 'property', 'station')
Any other ideas on how to treat data/Django table like this?