looker-open-source / sdk-codegen

One SDK to rule them all, and in the codegen bind them
MIT License
235 stars 195 forks source link

Unhandled SDKError looker_sdk.error.SDKError: <exception str() failed> #1454

Open bobwilkinson20 opened 7 months ago

bobwilkinson20 commented 7 months ago

Fresh install including a downgraded cattrs per the known issue with it. attrs==23.2.0 cattrs==23.1.2 certifi==2024.2.2 charset-normalizer==3.3.2 idna==3.7 looker-sdk==24.4.0 requests==2.31.0 typing_extensions==4.11.0 urllib3==2.2.1

Attempting to run example https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/simple_schedule_plan.py

Results in:

Traceback (most recent call last):
  File ".../schedule_updater.py", line 55, in <module>
    create_simple_schedule('1336',sdk.me().id,"This is an automated test", "assembled_pdf", "test@looker.com", "email", "Hi Looker User!", "0 1 * * *")
  File ".../schedule_updater.py", line 51, in create_simple_schedule2
    schedule = sdk.create_scheduled_plan(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/sdk/api40/methods.py", line 10699, in create_scheduled_plan
    self.post(
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/rtl/api_methods.py", line 188, in post
    return self._return(response, structure)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/rtl/api_methods.py", line 101, in _return
    raise sdk_error
looker_sdk.error.SDKError: <exception str() failed>
nathan-michel-devoteam commented 7 months ago

I have got quite the same problem here when calling function sdk.create_group with Python sdk (but it works for other functions). In fact it creates the group as expected but still triggers this weird error I have also looker-sdk version 24.4.0 and my looker instance is on 24.4.28 (Looker original)

kiran2706 commented 6 months ago

I've fixed this issue, but I can't create a new branch in this repo. Can somebody please help me fix the permission issue and assist me in making my first contribution? Thank you.

cc: @jkaster @joeldodge79 @josephaxisa

jlieow commented 5 months ago

Fresh install including a downgraded cattrs per the known issue with it. attrs==23.2.0 cattrs==23.1.2 certifi==2024.2.2 charset-normalizer==3.3.2 idna==3.7 looker-sdk==24.4.0 requests==2.31.0 typing_extensions==4.11.0 urllib3==2.2.1

Attempting to run example https://github.com/looker-open-source/sdk-codegen/blob/main/examples/python/simple_schedule_plan.py

Results in:

Traceback (most recent call last):
  File ".../schedule_updater.py", line 55, in <module>
    create_simple_schedule('1336',sdk.me().id,"This is an automated test", "assembled_pdf", "test@looker.com", "email", "Hi Looker User!", "0 1 * * *")
  File ".../schedule_updater.py", line 51, in create_simple_schedule2
    schedule = sdk.create_scheduled_plan(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/sdk/api40/methods.py", line 10699, in create_scheduled_plan
    self.post(
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/rtl/api_methods.py", line 188, in post
    return self._return(response, structure)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../.pyenv/versions/3.12.2/lib/python3.12/site-packages/looker_sdk/rtl/api_methods.py", line 101, in _return
    raise sdk_error
looker_sdk.error.SDKError: <exception str() failed>

Error originates from the object models40.ScheduledPlanDestination() and can be replaced with a json equivalent:

{
  "format": format,
  "apply_formatting": True,
  "apply_vis": True,
  "address": email,
  "type": type,
  "message": message,
}
jeremytchang commented 3 months ago

Thanks for reporting this!

We welcome and encourage all contributions! However for testing/security reasons, we don't give write privileges to developers outside of google. @kiran2706 Can you setup a fork and a PR with your changes? We'll setup a PR in this repo with your commit (so you can have contribution). Thanks in advance!