I encountered a similar problem today. Wanted a minimal set of fields to process frequently so created a smaller struct, with only a subset of key/value pairs of the full one. Then I fetch data from the DB in a manner very similar to the one described here:
IOW I am getting a Map
(well, list of maps in that particular example there) with only the key/value pairs I am interested in and pass it to struct!2
struct!(%MyMinimalStruct{}, my_map_from_db_query)
Seems almost suspiciously trivial… any gotchas?
Alternative could be to create another “model” with limited Ecto.Schema
defnition. Might check that route too