How to efficiently store a two-dimensional array with different File types in a Django Model (PostgresSQL)


I will like to store in a Django model the variations on the price of some houses for a date. For example:

House.objects.create(name='house1', prices=[
    ['27-12-2015', 200000],
    ['14-01-2016', 190000],
House.objects.create(name='house2', prices=[
    ['22-04-2015', 140000],

Because I'm using PostgreSQL I can use a two-dimensional array with ArrayField. But I think it can't contain different type of Fields (for example date and int).

I will also like to be efficient when doing queries to get the prices for all the houses between 2 dates.

So my question: which is the best approach for this problem?

Show source
| python   | arrays   | django   | django-models   | postgresql   2017-01-02 18:01 0 Answers

Answers ( 0 )

◀ Go back