'How to get distinct entries by MutableDict/JSON field in SQL-Alchemy?
Suppose I have a Listing table with a MutableDict extra_info column.
I know I can filter by this column via func.json_extract:
Listing.query.filter(func.json_extract(Listing.extra_info, "$.some_key") == "some-value")
But how can I get distinct listings by fields in this column?
# Something like...
Listing.query.distinct(func.json_extract(Listing.extra_info, "$.some_key"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
