-
Notifications
You must be signed in to change notification settings - Fork 119
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
Stop requestslib from overriding auth headers with data from .netrc file #338
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it needs to work with oauth as well. Token is not passed in config
I've updated the code to use the |
I found that the same issue we're fixing here (.netrc overrides auth headers in requests made by dbt-databricks) also affects our databricks-sdk-py repo (.netrc overrides auth headers in requests made for oauth handshake). The fix in this PR will fix dbt-databricks .netrc woes if the auth method is PAT. But it will only fix the issue for oauth use-cases after databricks-sdk-py is updated with this patch databricks/databricks-sdk-py#107 and we update the dbt-databricks dependency to incorporate that fix. Note: I found the same bug in |
Now that databricks-sdk has pushed the parallel fix for oauth I've rebased on |
Looks like there is now a parallel PR that bumps the databricks-sdk version and includes the |
Update changelog. Signed-off-by: Jesse Whitehouse <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
refactor to push the .auth into requests session. It's not required in DBContext anymore. Signed-off-by: Jesse Whitehouse <[email protected]>
.netrc fix. Signed-off-by: Jesse Whitehouse <[email protected]>
Alright, I've pushed the final version of this code. I moved the I also simplified the code by setting the |
Signed-off-by: Jesse Whitehouse <[email protected]>
This was leftover from moving the authentication class into connections.py in 4f56a5c Signed-off-by: Jesse Whitehouse <[email protected]>
This fixes a merge conflict in the changelog Signed-off-by: Jesse Whitehouse <[email protected]>
## Changes This adds a new dbt-sql template. This work requires the new WorkspaceFS support for dbt tasks. In this latest revision, I've hidden the new template from the list so we can merge it, iterate over it, and propertly release the template at the right time. Blockers: - [x] WorkspaceFS support for dbt projects is in prod - [x] Move dbt files into a subdirectory - [ ] Wait until the next (>1.7.4) release of the dbt plugin which will have major improvements! - _Rather than wait, this template is hidden from the list of templates._ - [x] SQL extension is preconfigured based on extension settings (if possible) - MV / streaming tables: - [x] Add to template - [x] Fix databricks/dbt-databricks#535 (to be released with in 1.7.4) - [x] Merge databricks/dbt-databricks#338 (to be released with in 1.7.4) - [ ] Fix "too many 503 errors" issue (databricks/dbt-databricks#570, internal tracker: ES-1009215, ES-1014138) - [x] Support ANSI mode in the template - [ ] Streaming tables support is either ungated or the template provides instructions about signup - _Mitigation for now: this template is hidden from the list of templates._ - [x] Support non-workspace-admin deployment - [x] Make sure `data_security_mode: SINGLE_USER` works on non-UC workspaces (it's required to be explicitly specified on UC workspaces with single-node clusters) - [x] Support non-UC workspaces ## Tests - [x] Unit tests - [x] Manual testing - [x] More manual testing - [ ] Reviewer manual testing - _I'd like to do a small bug bash post-merging._ - [x] Unit tests
Resolves #337
Description
This pull request refactors the credentials handling in
python_submissions.py
using the workaround suggested in #337. The desired behaviour from this change is not obvious when looking only at the code diff. However the idea here is to explicitly order Python requests to use Bearer authentication with an explicitly provided token. If this is not done explicitly, there is an edge case where a local.netrc
file can override an auth token present inprofiles.yml
.There's no automated test for this because I'm not sure how to deposit a .netrc file in a test environment.
I reproduced the issue manually by adding this to
~/.netrc
on my workstation:I removed the skip marker on
test_python_uc_databricks_sql_endpoint
and ran this integration test on themain
branch. The test failed with this exception:Then I applied the change in this pull request and re-ran the test. It passed.
Checklist
CHANGELOG.md
and added information about my change to the "dbt-databricks next" section.