Getting a column out of Projects (beta) #24598
-
I’m very new to GraphQL, so this might just be a learning the ropes thing, but so far the various tools, docs, samples and examples haven’t been enough to get me where I need to be. For old style projects we have a set of scripts that dump out card details (id, description, story points from labels) to .csv files that can be imported into Planning Poker. It’s all pretty straightforward: find the project id, find the column id, iterate across the cards (issues) in the column to get what’s needed from them. For beta projects the first hurdle seems to be that columns aren’t really a thing. It’s just a view onto the underlying data. Status (and the Group by Status view) is perhaps equivalent though. And I can see stuff about Status using a query like:
Which gets me a response that includes:
and if I run that settings response through jq I see:
But what to do with that? How do I then construct a query that gets a bunch of card details out of settings:MTIzOlByb2plY3ROZXh0RmllbGQ0NTY3OA==:47fc9ee4 ? Of course it doesn’t help that the GitHub GraphQL Explorer doesn’t support the ‘GraphQL-Features: projects_next_graphql’ How about a few more examples please that go beyond trivial first:20 type summaries, and show how to combine and filter across the object relationships? PS project IDs above have been diddled with (base64 decoded, modified and then re-encoded). |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
You’re already using the docs from Using the API to manage projects (beta) - GitHub Docs, presumably. If you’re after details of Issues, looks to me like those are of type ProjectNextItem so I reckon you want to grab ‘items’ rather than ‘fields’ in your initial query with the node ID. The doc entry for ProjectNextItem in the Reference section of that URL tells you where you can ‘walk’ to next in the query. |
Beta Was this translation helpful? Give feedback.
-
Thanks @davidMbrooke and yes, already into the Using the API to manage projects (beta) - GitHub Docs docs - they just don’t have suitable examples of what I’m trying to do (and there’s not much more in the Form calls with GraphQL docs where there’s a solitary example that just uses first: and last:). The problem for me isn’t getting stuff out of issues, but rather filtering on just the things that have a given status. So I can use a query like this:
and it returns a lump of JSON with everything I need - issue IDs, titles, labels. But… there’s a lot of cruft in there. I should be able to do a query that just gets me the issues associated with |
Beta Was this translation helpful? Give feedback.
-
You’re right that the promise of GraphQL is to let you filter as you ‘walk’ around the graph data structure. The intent is to do the filtering server-side, to both reduce the amount of data that comes back and to reduce the load on the client. One good thing about GraphQL is that it’s far from being GitHub-specific, so docs for other GraphQL implementations or more generic docs can often be useful (which I suppose might be an excuse for a light-touch in the GitHub docs): take a look at Understanding GraphQL Filters | Tabnine Blog for example There’s also the totally generic GraphQL docs at Introduction to GraphQL | GraphQL |
Beta Was this translation helpful? Give feedback.
-
Thanks again @davidMbrooke From Understanding GraphQL Filters | Tabnine Blog it seems that I should be able to do something like:
As part of a full query like this:
But that just gives me
So I’m starting to think that the reason for no filter examples might be that filtering hasn’t been implemented (yet). I guess for now I’ll be doing my filtering in Python. |
Beta Was this translation helpful? Give feedback.
-
I got the filtering working in Python, with some new scripts added to my dump_cards repo. Most of the action is in the atdumpmemex.py module:
This doesn’t feel like the right GraphQL way, but it works. |
Beta Was this translation helpful? Give feedback.
-
Hi @cpswan, I am having the same question (see here). Did you find out a decent way to do server-side filtering? Thanks and cheers, |
Beta Was this translation helpful? Give feedback.
-
Alas no. So far as I can tell there’s been no progress on server side filtering. |
Beta Was this translation helpful? Give feedback.
-
Thanks @cpswan. Really hope this is in some backlog… |
Beta Was this translation helpful? Give feedback.
I got the filtering working in Python, with some new scripts added to my dump_cards repo.
Most of the action is in the atdumpmemex.py module: