Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python client changes, more docs, fix pdm #490

Merged
merged 5 commits into from
May 4, 2023
Merged

Python client changes, more docs, fix pdm #490

merged 5 commits into from
May 4, 2023

Conversation

samredai
Copy link
Contributor

@samredai samredai commented May 4, 2023

Summary

This PR makes a number of minor changes to the python client as well as docs.

  • Removed pandas as a requirement for the client and catch+raise when it's not installed (only when the data methods are called). This lets those interested in simply using the CRUD component of the python client to not have to pull in a beefy dependency like pandas.
  • Adds a few inspections of the response status and the "state" value to raise some clearer exceptions when the response or query fails.
  • Sets engine_name and engine_version defaults to None so the server default is used. I also moved allowed these to be set at client instantiation so users can set it once and have it consistently used through the session. (Users can still override the client setting on individual method calls)
  • Adds a client level method for retrieving multiple metrics and dimensions together, dj.data(metrics=[...], dimensions=[...], filters=[...])
  • Fills in the content for the "Requesting Data" docs page and makes some corrections to the "Requesting SQL" docs page.

Test Plan

pip installed the client and used it against a local DJ instance.

  • PR has an associated issue: #
  • make check passes
  • make test shows 100% unit test coverage

Deployment Plan

N/A

@samredai samredai changed the title More docs Python client changes and more docs May 4, 2023
Copy link
Contributor

@shangyian shangyian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Left some comments but only one is specifically about this PR

client/python/datajunction/client.py Outdated Show resolved Hide resolved
client/python/datajunction/client.py Outdated Show resolved Hide resolved
@samredai
Copy link
Contributor Author

samredai commented May 4, 2023

urllib3 broke the world so I'll have to pin to urllib3<2...

@samredai
Copy link
Contributor Author

samredai commented May 4, 2023

Huge thanks to this kind soul for sharing the solution as setting PDM_DEPS='urllib3<2': pdm-project/pdm#1879 (comment)

@samredai samredai changed the title Python client changes and more docs Python client changes, more docs, fix pdm May 4, 2023
@samredai samredai merged commit 95a2c03 into DataJunction:main May 4, 2023
youngman-droid pushed a commit to youngman-droid/dj that referenced this pull request Aug 26, 2023
* requesting data docs

* python client and docs changes

* Use destructuring for js client example

* PR feedback

* PDM_DEPS='urllib3<2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants