nasa / python_cmr

Python library for querying the common metadata repository.
MIT License
24 stars 22 forks source link

add CMR graphql functionalities #61

Open briannapagan opened 5 months ago

briannapagan commented 5 months ago

NASA has created a GraphQL interface for accessing CMR: https://github.com/nasa/cmr-graphql

Some of the advantages of this way to query are supposed to be 1) performance and 2) the ability to search across different schemas, which can be a huge pain point for users of the regular CMR API. Internally we are beginning to pass code around to demonstrate how to pythonically call CMR-GraphQL, and I have been wondering whether those of us maintaining python_cmr should invest time to bring the ability to query from GraphQL as an option within python_cmr.

mfisher87 commented 5 months ago

GraphQL's self-describing-ness is also huge. We could for example generate an API client: https://github.com/mirumee/ariadne-codegen

frankinspace commented 5 months ago

I agree adding support to query cmr's graphql endpoints should be on the roadmap for this library. IMO, this library should exclusively utilize CMR's graphql endpoints.

I also agree with @mfisher87 that we should utilize some level of code-generation to build out the library.

Perhaps it would make sense to add a cmr.graphql module so this option could be explored without breaking the existing interface? Eventually we might be able to start rewriting the existing functions to just call this new graphql module.

mfisher87 commented 5 months ago

I think based on some discussions during today's hack week @doug-newman-nasa may be able to provide some context about performance to this discussion. I think someone said that there are areas of the GraphQL API that are limited by CMR performance, and could technically perform worse, and this library could abstract away the need for that knowledge, always doing what's most performant.