Fork me on GitHub
#pathom
<
2019-10-20
>
wilkerlucio01:10:37

@splayemu this still looks strange, what is :user-room/id? did you mean to get the id from the room? if that so, your output should be like: {:room/user {:user/id id}}, makes sense?

Spencer Apple14:10:56

No since I queried into my room table first by :user/id and then by :room/id I concatted the ids into an ident. [:user/id :room/id]. For now I am just using atoms to store my data so the query is just (get-in @room-table [user-id room-id)

Spencer Apple14:10:34

Thank you for all the help understanding pathom!

schmee09:10:46

Hi! is it possible to programmatically generate resolvers? I want to try to generate resolvers from a SQL database using foreign keys to resolve between tables

schmee09:10:37

hmm, judging by what defresolver actually creates it looks like I can just create a #:com.wsscode.pathom.connect{:input ... :output ... :resolve ...} map myself, right? 🙂

schmee10:10:00

A question about query optimization: I have to two tables, user and organization, and each user has an organization_id that links between the two. I’ve set up some basic resolvers and it works great, but it runs two queries: - SELECT ... FROM user WHERE id = ? to get the user data and organization id - SELECT ... FROM organization WHERE id = ? to get the organization data Is it possible to somehow combine these into

SELECT ... 
FROM user u 
WHERE u.id = ?
INNER JOIN organization o ON u.organization_id = o.id`
I have tables that are linked like this “N steps”, and it would be fantastic if I could combine it into one query with “N” joins instead of “N” separate queries.

schmee10:10:08

I looked at batch resolvers, am I correct that they are more for avoiding multiple calls when you have multiple results from your query, rather than avoiding joins?

schmee10:10:17

and btw, can I just say that Pathom is absolutely amazing 🤯

👍 4
schmee12:10:17

One more question: is it possible in a resolver to know which outputs are requested? For example, I have a resolver that provides all the data in a table using SELECT * FROM .... But often you only need one or two outputs from a resolver to fulfill the query, and it would be more efficient to do SELECT column1, column2 FROM ... instead. But I couldn’t find anything in the env that say “this is the data I need from the outputs to fulfill the this specific query”, is there such a thing?

myguidingstar06:10:51

are you looking for :com.wsscode.pathom.core/parent-query in resolver's input env?

👍 4
schmee12:10:08

and sorry for the wall of questions 😅

adamfeldman17:10:01

@schmee you may be interested in Walkable, which uses Pathom to fetch data from SQL databases: https://github.com/walkable-server/walkable

schmee17:10:33

I gave it a run earlier, but it lacks some things that I need: - no resolver support, so you have to explicitly specify your “N” joins in your queries (dealbreaker for me) - no optimization like the one I described above: it does one query per table

adamfeldman17:10:24

Thank you for sharing your experience with Walkable! I haven’t used it yet, so this is helpful

👍 4