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

Added REST API as a data source #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

GeorgelPreput
Copy link

@GeorgelPreput GeorgelPreput commented Mar 5, 2024

As per the recent Champions call, I've adapted my existing REST API data source to the PySpark Data Sources framework.

Currently supports as options:

  • Sending headers
  • No authentication, basic authentication, bearer token (via headers) and OAUTH2
  • Both GET and POST
  • Sending parameters
  • Sending text data
  • Sending JSON data

Output dataframe contains both the contents of the request, as well as the actual response, be that text data, JSON data or an error.

Known issues:

  1. Having the protocol (http/https) in the call to .load("https://url-goes-here") makes Spark directly assume that the source should be Delta (at least in Databricks). Therefore, the URL passed must not have the protocol, and it can be added as an optional parameter: .option("protocol", "http"). The implicit default for this option is https.
  2. Since both the request and the response get saved, a further # TODO might be to try to redact any tokens and client secrets from the output. Will add that upon request.

Copy link
Owner

@allisonwang-db allisonwang-db left a comment

Choose a reason for hiding this comment

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

This is awesome! Thanks for adding it 👍

@GeorgelPreput
Copy link
Author

Is there anything else I should add / modify?

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