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

Python: lookml_model_explore() raises an error - RuntimeError: super(): __class__ cell not found #334

Closed
erik-heintare opened this issue Sep 28, 2020 · 3 comments · Fixed by #335
Assignees

Comments

@erik-heintare
Copy link

erik-heintare commented Sep 28, 2020

All other functions work as expected but when I use lookml_model_explore() with whatever explore_name then I get an error RuntimeError: super(): __class__ cell not found. I can bypass the error when defining fields parameter without fields value, like fields="id, name, description" then it works as expected. Since fields is the main value I'm looking for then would be nice to know what is causing this issue.

Full code:

import looker_sdk

sdk = looker_sdk.init40()

a = sdk.lookml_model_explore(lookml_model_name='example',explore_name='example2')

print(a)

Full error report:

Traceback (most recent call last):
  File "/Users/erik/Documents/looker/quality/main.py", line 5, in <module>
    a = sdk.lookml_model_explore(lookml_model_name='example',explore_name='example2')
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/sdk/api40/methods.py", line 5226, in lookml_model_explore
    response = self.get(
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/api_methods.py", line 152, in get
    return self._return(response, structure)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/api_methods.py", line 101, in _return
    ret = self.deserialize(data=value, structure=structure)  # type: ignore
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/serialize.py", line 72, in deserialize
    response: TDeserializeReturn = converter.structure(  # type: ignore
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 192, in structure
    return self._structure_func.dispatch(cl)(obj, cl)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 314, in structure_attrs_fromdict
    dispatch(type_)(val, type_) if type_ is not None else val
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 387, in _structure_union
    return self._structure_func.dispatch(other)(obj, other)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/serialize.py", line 125, in forward_ref_structure_hook
    instance = converter.structure_attrs_fromdict(data, actual_type)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 314, in structure_attrs_fromdict
    dispatch(type_)(val, type_) if type_ is not None else val
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 387, in _structure_union
    return self._structure_func.dispatch(other)(obj, other)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 325, in _structure_list
    return [
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 326, in <listcomp>
    self._structure_func.dispatch(elem_type)(e, elem_type)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/serialize.py", line 125, in forward_ref_structure_hook
    instance = converter.structure_attrs_fromdict(data, actual_type)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 314, in structure_attrs_fromdict
    dispatch(type_)(val, type_) if type_ is not None else val
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 387, in _structure_union
    return self._structure_func.dispatch(other)(obj, other)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/serialize.py", line 122, in forward_ref_structure_hook
    instance = converter.structure(data, actual_type)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 192, in structure
    return self._structure_func.dispatch(cl)(obj, cl)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/cattr/converters.py", line 264, in _structure_call
    return cl(obj)
  File "/Users/erik/.pyenv/versions/3.8.2/lib/python3.8/enum.py", line 304, in __call__
    return cls.__new__(cls, value)
  File "/Users/erik/.local/share/virtualenvs/quality-09nN-6uz/lib/python3.8/site-packages/looker_sdk/rtl/model.py", line 173, in safe_enum__new__
    return super().__new__(cls, value)
RuntimeError: super(): __class__ cell not found
@erik-heintare
Copy link
Author

Additional comment here is that I used this to create virtualenv and the same error occurs with all model&explore pairs, so it's not related with weird fields or etc.

@joeldodge79
Copy link
Contributor

It looks like there's a bug in our codegen around how we interpret the LookmlModelExploreField.user_attribute_filter_types type. It should be an Optional[Sequence["UserAttributeFilterTypes"]], not a Optional["UserAttributeFilterTypes"]

We recently introduced Enum types and this looks like a bug in that code. I'll get a fix up shortly

@joeldodge79
Copy link
Contributor

https://pypi.org/project/looker-sdk/0.1.3b17/ has the fix

This was referenced Mar 24, 2021
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 a pull request may close this issue.

2 participants