Skip to main content
Solved

Get access to GraphQL through python SDK


As Data Engineer I need access to GraphQL through python SDK

  • to modify Data Models GraphQL: to update versions of imported views from different Data Models
  • to read Data Models GraphQL: to parse specific info that I can not get through python SDK. For example
    • check if view was imported
    • what the source of imported view

Best answer by Dimitry Hoff

Hi,
Have you tried using existing GraphQL client libraries in python, for example
https://pypi.org/project/python-graphql-client/

It should work "out of the box", provided with a URL to GraphQL endpoint and Bearer Token for authentication.

GraphQL endpoint url can be found in Data Modeling UI, if you click on the URL button.
As for Bearer Token it is the same token that is used to authenticate to CDF (see https://developer.cognite.com/sdks/python/python_auth_oidc) and can be acquired with msal (already installed with cognite-sdk) and

View original
Did this topic help you find an answer to your question?

3 replies

  • Practitioner
  • 3 replies
  • Answer
  • November 6, 2023

Hi,
Have you tried using existing GraphQL client libraries in python, for example
https://pypi.org/project/python-graphql-client/

It should work "out of the box", provided with a URL to GraphQL endpoint and Bearer Token for authentication.

GraphQL endpoint url can be found in Data Modeling UI, if you click on the URL button.
As for Bearer Token it is the same token that is used to authenticate to CDF (see https://developer.cognite.com/sdks/python/python_auth_oidc) and can be acquired with msal (already installed with cognite-sdk) and


Thank you


Anita Hæhre
Seasoned Practitioner
Forum|alt.badge.img+1
  • Head of Academy and Community
  • 590 replies
  • November 9, 2023

@almir.mavliutov thanks for your questions! We hope @Dimitry Hoff’s reply helped. We’ll convert this thread into a question, please do reach out should you have further questions or thoughts. 


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings