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

AttributeError: unable to unmarshal <response> as StreamPropertiesResponse #52

Open
henriquemeloo opened this issue Dec 5, 2023 · 3 comments

Comments

@henriquemeloo
Copy link

Making the following request

airbyte.Airbyte(server_url=server_url).streams.get_stream_properties(
    airbyte.models.operations.GetStreamPropertiesRequest(
        destination_id, source_id))

raises

AttributeError: unable to unmarshal <response> as typing.Optional[airbyte.models.shared.streampropertiesresponse.StreamPropertiesResponse

while running

curl '{apiUrl}/streams?sourceId={sourceId}&destinationId={destinationId}' --header 'accept: application/json'

successfully returns the same <response>

@GKTheOne
Copy link

Just hit this myself.
I'm using Airbyte OSS version 0.50.40 and airbyte-api versions 0.44.2 0.44.3, and it looks like the get_stream_properties API endpoint is returning a list of StreamProperties instead of the StreamPropertiesResponse expected by the airbyte-api library.

@Posrabi
Copy link

Posrabi commented Feb 5, 2024

I got this myself too, like what @GKTheOne is saying

@AliHarake
Copy link

I got the same error as you guys and fixed the issue in the airbyte/utils/utils.py by modifying the unmarshal_json function to accept a list and it worked

def unmarshal_json(data, typ, decoder=None):
    unmarshal = make_dataclass('Unmarshal', [('res', List[typ] if isinstance(json.loads(data), list) else typ)],
                               bases=(DataClassJsonMixin,))
    json_dict = json.loads(data)
    try:
        out = unmarshal.from_dict({"res": json_dict})
    except AttributeError as attr_err:
        raise AttributeError(
            f'unable to unmarshal {data} as {typ} - {attr_err}') from attr_err

    return out.res if decoder is None else decoder(out.res)

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

No branches or pull requests

4 participants