The project is running on Django. I set up my model as follows:
import architect
from django.contrib.postgres.fields import JSONField
@architect.install('partition', type='range', subtype='string_firstchars', constraint='10', column='collection')
class PartitionedDocument(models.Model):
collection = models.CharField(max_length=10)
content = JSONField(default=dict)
In other words, I am partitioning using the first 10 characters of the collection field. Plus, I ensure the collection is always a string of 10 characters (from a pre-determined list), so its a nice partitioning system. The list looks like this:
If everything went correctly, I should only be hitting the table that corresponds to the collection with a value of '91IJAYXLPc', and then I would filter based on the JSONField. I know for a fact that objects that fall under this condition exists in my database, however, the queryset returned is empty.
The project is running on Django. I set up my model as follows:
In other words, I am partitioning using the first 10 characters of the
collection
field. Plus, I ensure thecollection
is always a string of 10 characters (from a pre-determined list), so its a nice partitioning system. The list looks like this:Anyway, I added some data to my database after doing all this, and then ran a query like so:
If everything went correctly, I should only be hitting the table that corresponds to the
collection
with a value of '91IJAYXLPc', and then I would filter based on the JSONField. I know for a fact that objects that fall under this condition exists in my database, however, the queryset returned is empty.Did I do something wrong? Thanks.