Hi! I am using the `airbyte-python-sdk` and trying...
# airbyte-api
r
Hi! I am using the
airbyte-python-sdk
and trying to use the
streams/get_stream_properties
endpoint, but it crashes before returning the response. From checking the get_stream_properties method with a debugger, I can see that the response is returned from the API request successfully, but crashes as soon as it tries to run the
utils.unmarshall_json
method to normalize the response. Here's the stack trace of your end:
Copy code
File "/venv/lib/python3.11/site-packages/airbyte/streams.py", line 34, in get_stream_properties
    out = utils.unmarshal_json(http_res.text, Optional[shared.StreamPropertiesResponse])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/airbyte/utils/utils.py", line 681, in unmarshal_json
    out = unmarhsal.from_dict({"res": json_dict})
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/api.py", line 72, in from_dict
    return _decode_dataclass(cls, kvs, infer_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 206, in _decode_dataclass
    init_kwargs[field.name] = _decode_generic(field_type,
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 282, in _decode_generic
    res = _decode_dataclass(type_arg, value, infer_missing)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 141, in _decode_dataclass
    kvs = {decode_names.get(k, k): v for k, v in kvs.items()}
                                                 ^^^^^^^^^

Exception Type: AttributeError at /v1/data-streams/
Exception Value: 'list' object has no attribute 'items'
I will add that the
source_id
I used is of a file source (CSV), and the
destination_id
I used is of a Snowflake destination
j
Hey Ron, thanks for the detailed error report! We’ll take a look to see what’s going on, likely something to do with how our SDK is being generated. If we end up needing to publish a new version of the SDK we will let you know.
r
Thanks! following this thread for new updates
j
@Ron Braha do you mind sharing what version of the python SDK you’re using? I assume latest, but wanted to confirm.
r
Hi, When posting this, I was using version 0.15.1 I noticed today that there was a newer version (0.24.2), which I tested today and experienced the same issue
j
Hey Ron - just a quick update, our team is looking into this but the fix isn’t straightforward. Will keep you posted as we get closer to a solution.
r
Thanks for the update! I'll keep following up here
Hi, is there any workaround I can do for now until you will fix this issue? it starts to become a blocker for some important workflows I am working on. if there are any updates i'd love to know too, thanks for your help!
j
Hi Ron - as of yesterday we actually do think we’ve found the issue and are going to try to correct it and re-release the SDK in the next day or so. Thanks for your patience!
r
That's great news! I will hold and wait for updates
Hi, I saw a new version of the SDK, so I updated it, and now I see a more descriptive exception:
Copy code
Exception Value: unable to unmarshal [{"streamName":"Phone numbers","syncModes":["full_refresh_append","full_refresh_overwrite"],"sourceDefinedCursorField":false,"propertyFields":[["name"],["phone_number"]]}] as typing.Optional[airbyte.models.shared.streampropertiesresponse.StreamPropertiesResponse]
j
Hey Ron - that wasn't the update that needed to go out, I'll try to have that out today and it will hopefully be available tomorrow!
r
Thanks for clarifying, I assumed that, but figured it worth posting the exception here in case it can be helpful
j
We do appreciate that Ron - thanks for your patience. We had some unexpected work come up today and didn’t get a chance to put up a new version of the SDK. We’re planning on working on that tomorrow and will have a new version of the SDK for you by Wednesday!
r
Hey, any updates on this issue?
j
Ron, thanks for your patience with this one. We republished the sdk yesterday, can you update and give this another try?
r
Hi, Thanks for releasing this update! unfortunately, it seems like I'm getting a similar response:
Copy code
unable to unmarshal [{"streamName":"Phone numbers api test","syncModes":["full_refresh_append","full_refresh_overwrite"],"sourceDefinedCursorField":false,"propertyFields":[["name"],["phone_number"]]}] as typing.Optional[airbyte.models.shared.streampropertiesresponse.StreamPropertiesResponse]
Stack Trace:
Copy code
Traceback (most recent call last):
  File "/venv/lib/python3.11/site-packages/airbyte/utils/utils.py", line 682, in unmarshal_json
    out = unmarhsal.from_dict({"res": json_dict})
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/api.py", line 70, in from_dict
    return _decode_dataclass(cls, kvs, infer_missing)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 219, in _decode_dataclass
    init_kwargs[field.name] = _decode_generic(field_type,
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 306, in _decode_generic
    res = _decode_dataclass(type_arg, value, infer_missing)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/dataclasses_json/core.py", line 149, in _decode_dataclass
    kvs = {decode_names.get(k, k): v for k, v in kvs.items()}
                                                 ^^^^^^^^^

The above exception ('list' object has no attribute 'items') was the direct cause of the following exception:
  File "/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
    return view_func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/rest_framework/viewsets.py", line 125, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
    ^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The tested source and destination are File -> Snowflake
j
Hmm I’m wondering if our publish process isn’t picking up the changes we’re making. We’ll dig back into that now.
r
I'll add that this issue is no longer in high severity on my end, but I'd be happy to test it further after you have any updates
j
We’re digging in - glad to hear it’s no longer blocking you, but will keep you posted here on the progress we make. Thanks again for your patience and help in testing!