Skip to content

Calling client.list_models() throws an error #2

@bramrodenburg

Description

@bramrodenburg

Description

When calling client.list_models(), it throws the following error:

Traceback (most recent call last):
  File "/Users/bram/Developer/Repositories/python-sdk/bye.py", line 14, in <module>
    print(client.list_models())
          ^^^^^^^^^^^^^^^^^^^^
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/client.py", line 167, in list_models
    return self.models.list() 
           ^^^^^^^^^^^^^^^^^^
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/models.py", line 159, in list
    self._ensure_loaded()
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/models.py", line 138, in _ensure_loaded
    models = self._client._fetch_models()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/client.py", line 154, in _fetch_models
    return [Model.from_api_response(item) for item in response_data]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/client.py", line 154, in <listcomp>
    return [Model.from_api_response(item) for item in response_data]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/bram/Developer/Repositories/python-sdk/lightdash/models.py", line 114, in from_api_response
    type=data["type"],
         ~~~~^^^^^^^^
KeyError: 'type'

Reproduction path

  1. Initialise a new client
  2. Call client.list_models()
  3. It throws an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions