我有一个带有多个字段的Django模型,它映射到一个MySQL数据库。现在在该模型中有一个日期时间字段,我想设置分区。
该模型如下所示:
class Packet(models.Model):
device = models.ForeignKey(Device)
packet_time = models.DateTimeField(default=timezone.now())
# Location Details
signal = models.CharField(max_length=2, default='A')
lat = models.FloatField(default=None, null=True)
lat_indicator = models.CharField(max_length=1, default='')
lng = models.FloatField(default=None, null=True)
lng_indicator = models.CharField(max_length=1, default='')
address = models.CharField(max_length=64, default='NA')
speed = models.FloatField(default=None, null=True)
orientation = models.FloatField(default=None, null=True)
#House Keeping Items
dor = models.DateTimeField(default=timezone.now()) # <= Want to partition this for weekly basis.
dirty = models.BooleanField(default=False)
请为我提供建议,如何实现这一目标。
https://github.com/danfairs/django-parting
https://pypi.python.org/pypi/django-db-parti#id2 - Anish Shah