发布于2021-03-06 18:31 阅读(942) 评论(0) 点赞(15) 收藏(0)
0
1
2
3
4
5
I am working with table partitioning in MYSQL. I have partitioned my data according to Month such that there are 12 partition for each month. I have applied partition in database level but now want to introduce a queryset method in Django which lets me to select specific partition to query.
from django.db import models
def Person(models.Model): # My partitioned Model
name = models.CharField(max_length=100)
created_month = models.IntegerField()
# I want query like this
Person.objects.using_partition("p0", "p1").filter(name="Kamal")
# Generated SQL(MYSQL): SELECT * FROM person_person PARTITION(p0,p1) where name='kamal'
As seen above I want to add PARTITION(p0,p1) but after FROM table_name.
0
1
2
3
4
5
6
7
8
9
作者:黑洞官方问答小能手
链接: https://www.pythonheidong.com/blog/article/879591/4e0229b1762562ad3679/
来源: python黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
Copyright © 2018-2021 python黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-1
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!