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

Error when dict object is empty #1

Closed
allanw opened this issue Dec 23, 2020 · 1 comment
Closed

Error when dict object is empty #1

allanw opened this issue Dec 23, 2020 · 1 comment

Comments

@allanw
Copy link

allanw commented Dec 23, 2020

On line 268 of impl.py:

if not (type(obj) is dict and obj.keys()):
, an exception is raised when the type of an object is a dict and obj.keys() returns False (e.g. if it's an empty dict).

This is causing my tap to fail even though it should run correctly - in this case, I have a value in my data which can take on a null value (it's defined in the schema as 'integrations': {'type': ['null', 'object']}) and can sometimes be populated, but is sometimes an empty dict ({}).

This causes the somewhat misleading exception to be raised:

KeyError: "property type (object) Expected a dict object.Got: <class 'dict'> {}"

Is the extra check for obj.keys() necessary? By removing it, I can successfully run the tap, since the empty dict doesn't cause any issues.

@daigotanaka
Copy link
Contributor

Hi @allanw

Thanks for investigating the code. It helped me to fix things quickly :)
I fixed and released the new version of tap-rest-api (v0.1.3) and tap-bigquery (v0.3.5)

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

2 participants