Hello to all,

at Pricemoov we’re using Postgresql arrays (
<https://www.postgresql.org/docs/15/arrays.html>
https://www.postgresql.org/docs/15/arrays.html) to store prices of a given
product.

More precisely, a given product can have either:

        - standard: N prices (1d array)

        - calendar: D * N prices, when the client is setting up different
prices for each day of a given time window (2d array)

So far, we modelled both use cases using a single table queried through raw
SQL queries.

We’re currently trying to migrate the raw SQL queries to Django’s ORM,
using ArrayField-s.

As per what is written at
<https://docs.djangoproject.com/en/4.1/ref/contrib/postgres/fields/#arrayfield>
https://docs.djangoproject.com/en/4.1/ref/contrib/postgres/fields/#arrayfield,
in a given field of a table, we can either have:

        - an ArrayField (1d), or

        - an ArrayField(base_field=ArrayField(…) …) (2d)

but cannot have both.

Instead of having different fields or different tables (one for standard
and one for calendar use cases), we’re exploring the possibility of adding
a custom field ArrayOrMatrixField. To have a better description of that
idea, we pushed the PR https://github.com/django/django/pull/15943 (WIP,
please do not consider it as a version ready to be reviewed for merge)

Given that such a field is not available in Django yet, we think there may
be a reason for that. More precisely, we’d have the following questions:

        - do you anticipate any feature incompatibility/logical bomb that
would be introduced by such a custom field?

        - if not, would you be interested in integrating such a field in
Django?

Best regards,

Liamine Cheridi, Backend Engineer at Pricemoov

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CABexJmYQD9Nq%2B14TrE0DiSx62iBFfGVToUnQnZ3PmJWFFoXXbQ%40mail.gmail.com.

Reply via email to