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

[Data] Fix Ray databricks UC reader with dynamic Databricks notebook scope token #45153

Merged
merged 2 commits into from
May 12, 2024

Conversation

WeichenXu123
Copy link
Contributor

@WeichenXu123 WeichenXu123 commented May 6, 2024

Why are these changes needed?

Set Ray databricks UC reader token by header Authorization: Bearer instead of requests.post auth param.

This fixes bugs on databricks dynamic token.

Testing code:

os.environ["DATABRICKS_TOKEN"] = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().get()

import ray

ds = ray.data.read_databricks_tables(
  warehouse_id='...',
  catalog='hive_metastore',
  schema='test_sb_dr',
  query='select * from students limit 10',
)

ds.to_pandas()

Result:

Before:
image

After:
image

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
@raulchen
Copy link
Contributor

raulchen commented May 6, 2024

@WeichenXu123 @c21 do we have a test for this reader?

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
@WeichenXu123
Copy link
Contributor Author

@WeichenXu123 @c21 do we have a test for this reader?

Yes, see test_databricks_uc_datasource test function.

@WeichenXu123 WeichenXu123 marked this pull request as ready for review May 7, 2024 09:43
@WeichenXu123
Copy link
Contributor Author

The PR is ready for reviewing. @raulchen

@WeichenXu123 WeichenXu123 changed the title [Databricks] Fix Ray databricks UC reader [Databricks] Fix Ray databricks UC reader with dynamic Databricks notebook token May 8, 2024
@WeichenXu123 WeichenXu123 changed the title [Databricks] Fix Ray databricks UC reader with dynamic Databricks notebook token [Databricks] Fix Ray databricks UC reader with dynamic Databricks notebook scope token May 8, 2024
@WeichenXu123
Copy link
Contributor Author

CC @c21

Copy link
Contributor

@c21 c21 left a comment

Choose a reason for hiding this comment

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

LGTM

@c21 c21 merged commit 0702f7c into ray-project:master May 12, 2024
5 checks passed
@c21 c21 changed the title [Databricks] Fix Ray databricks UC reader with dynamic Databricks notebook scope token [Data] Fix Ray databricks UC reader with dynamic Databricks notebook scope token May 12, 2024
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 6, 2024
…scope token (ray-project#45153)

Set Ray databricks UC reader token by header `Authorization: Bearer` instead of `requests.post` auth param.

This fixes bugs on databricks dynamic token.

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 6, 2024
…scope token (ray-project#45153)

Set Ray databricks UC reader token by header `Authorization: Bearer` instead of `requests.post` auth param.

This fixes bugs on databricks dynamic token.

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Ryan O'Leary <ryanaoleary@google.com>
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 7, 2024
…scope token (ray-project#45153)

Set Ray databricks UC reader token by header `Authorization: Bearer` instead of `requests.post` auth param.

This fixes bugs on databricks dynamic token.

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
GabeChurch pushed a commit to GabeChurch/ray that referenced this pull request Jun 11, 2024
…scope token (ray-project#45153)

Set Ray databricks UC reader token by header `Authorization: Bearer` instead of `requests.post` auth param.

This fixes bugs on databricks dynamic token.

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: gchurch <gabe1church@gmail.com>
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.

None yet

3 participants