What database are you using?
Some databases might support this natively, others would have to be
emulated by the ORM.

I’m not a big user of the ORM, so someone else would have to help you with
that.

If you’re using Postgres, then the array_agg function on the color column
will give you exactly what you want.

I imagine that without an array_agg like function, two queries would have
to be executed.

One to get the minimum price, the other to get a list of the colors using
the logic that sqlalchemy ORM has to group rows into a list.
Then the results of these two queries would have to be presented as your
result.

I’m curious to know if that’s possible with the ORM.

On Thu, Sep 5, 2019 at 12:10 AM Andrew M <[email protected]> wrote:

> Thank you Varun - what you've shown in the table is exactly what I'm
> looking for.
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sqlalchemy/5426ccc8-a2ed-4d35-97ec-f7f9d53e29aa%40googlegroups.com
> <https://groups.google.com/d/msgid/sqlalchemy/5426ccc8-a2ed-4d35-97ec-f7f9d53e29aa%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CADm-oGnXUagAU0L1G2Z7s_w8bJaELtM0if98_crvkvqcDrgiuQ%40mail.gmail.com.

Reply via email to