Skip to content

Conversation

@jakewski
Copy link

@jakewski jakewski commented Jan 16, 2024

Problem

I opened this issue: #318. My use case involves using the Databricks SQL connector in a multi-threaded web application where we may not want to set the proxy for all traffic. The current method of using environment variables would not allow that.

Solution

Proxy specification works same way as the Python requests module - it will default to whatever is set in the environment variable, but it can manually be overridden for a single request / connection if desired.

@jakewski
Copy link
Author

I would like to add a test for this in client tests - but seems they don't actually run in CI. Any guidance would be much appreciated! #317

@susodapop
Copy link
Contributor

Thanks for this contribution. We have rather poor testing facilities for proxies at present (we need proper CI for this repository -- that's coming soon). Will review and perform some manual testing in the next couple weeks.

@susodapop susodapop self-assigned this Jan 25, 2024
@jakewski
Copy link
Author

Thanks for this contribution. We have rather poor testing facilities for proxies at present (we need proper CI for this repository -- that's coming soon). Will review and perform some manual testing in the next couple weeks.

sounds good, appreciate the review!

Signed-off-by: Levko Kravets <levko.ne@gmail.com>
@kravets-levko
Copy link
Contributor

Hi @jakewski! Sorry for not getting back for so long. First of all, thank you for your effort - this indeed is a useful feature to have in this library. The changes you made look good. However, there are two more places that need to be updated as well:

  • OAuth manager. OAuth endpoints are located on the same host as Thrift backend, so if you need proxy to execute query - you definitely need the same proxy for OAuth
  • CloudFetch handler - same reasoning as above.

Indeed, we can merge this as is, but in this case the feature will be limited, and eventually other users will complain about it

@jerrylin3321
Copy link

After this PR was merged: #673

It seems like we can just do with sql.connect({"_http_proxy": PROXY_URL}) as connection:

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.

4 participants