absinthe-graphql / absinthe_ecto

DEPRECATED: Use dataloader
MIT License
130 stars 36 forks source link

Select only some schema fields #15

Closed xtagon closed 7 years ago

xtagon commented 7 years ago

Hi,

Some of my tables have fields that serialize very large values in Postgres hstore or jsonb columns. Will batching with absinthe_ecto always include those columns in queries, and if so, how can I control that? There are many situations where I wouldn't want those columns included in a query unless their respective GraphQL field is included in the query, especially for has_many associations where there could be a lot.

benwilson512 commented 7 years ago

Hey there. Absinthe.Ecto doesn't handle this automatically. However you can use the recently merged #11 query function to do specific selections, and the https://hexdocs.pm/absinthe/Absinthe.Resolution.html#project/1 function to figure out what child selections are required.

xtagon commented 7 years ago

Thanks @benwilson512. I'll give it a shot and re-open this if I run into any blockers.