Skip to content

Conversation

@tanmay-db
Copy link
Contributor

@tanmay-db tanmay-db commented Oct 22, 2025

WIP

What changes are proposed in this pull request?

When logging error, we check for empty body by using len(), however this doesn't work for example with _io.BytesIO
TypeError: object of type '_io.BytesIO' has no len()

How is this tested?

  • Will add if this is the preferred approach

def _redacted_dump(self, prefix: str, body: str) -> str:
if len(body) == 0:
return ""
try:

Choose a reason for hiding this comment

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

I think we should check isinstance(body, str) instead of try catch

Choose a reason for hiding this comment

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

Also could we try str(body)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, I think isinstance would be better.

@github-actions
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 1082
  • Commit SHA: bcf1897007acafa8cb15d594b94dce4a7db15ea4

Checks will be approved automatically on success.

Comment on lines +113 to +114
if not isinstance(body, str):
return "unsupported body type"
Copy link
Contributor

Choose a reason for hiding this comment

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

The method signature says that this should be a string. Either adjust the type to cover all potential cases or make sure that the method is only called with string inputs.


### Bug Fixes
- Improving the error message that is shown when the unsupported `dbutils.credentials.getServiceCredentialsProvider` method is used. This method can only be used inside of a notebook.
- Check for string body type while logging error message.
Copy link
Contributor

@renaudhartert-db renaudhartert-db Oct 22, 2025

Choose a reason for hiding this comment

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

I think we could have a message that explains a little more what the change is about. For example, as a reader, I'm wondering "what does checking for string body type" actually does? I believe something like the following would more useful:

Fix a TypeError error when logging non-string body types in RoundTrip.

Also, could you update the change log above so that it phrased at the imperative tense? That is "Improve the error message ..."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @renaudhartert-db, thanks for the review.

The PR is WIP and I just added a short line so it doesn't fail check for next changelog test, was planning to elaborate it and add test before sending it to review.

@tanmay-db
Copy link
Contributor Author

closing this since @serena-ruan has a fix for this issue.

@tanmay-db tanmay-db closed this Oct 24, 2025
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