-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Airbyte CDK: Improve error for returning non-iterable from connectors parse_response #17047
Comments
Thanks for suggesting this, you can submit the change. The question is how do you will assert the output of yield? |
Good question. Feels quite tricky to do it in a robust way here.
I imagine something like: try:
message = AirbyteRecordMessage(stream=stream_name, data=data, emitted_at=now_millis)
except pydantic.error_wrappers.ValidationError as e:
if "value is not a valid dict" in str(e) :
raise TypeError("Should return an iterator of dics from parse response") from e
raise e |
I think it is a good idea @Gitznik do you mind submitting a PR then I'll ask the CDK team to review it? |
…nectors parse_response (#17626) * Improve airbyte cdk invalid message data type error message * Test cdk invalid message data type custom error is raised * Fix test to pass stream as a string * Add valid record message data input type test * Add object type and value to AirbyteRecordMessage validator message Co-authored-by: Alexandre Girard <alexandre@airbyte.io>
…vation * master: (32 commits) fixed octavia position and z-index on onboarding page (#17708) Revert "Revert "Do not wait the end of a reset to return an update (#17591)" (#17640)" (#17669) source-google-analytics-v4: use hits metric for check (#17717) Source linkedin-ads: retry 429/5xx when refreshing access token (#17724) 🐛 Source Mixpanel: solve cursor field none expected array (#17699) 🎉 8890 Source MySql: Fix large table issue by fetch size (#17236) Test e2e testing tool commands (#17722) fixed escape character i18n error (#17706) Docs: adds missing " in transformations-with-airbyte.md (#17723) Change Osano token to new project (#17720) Source Github: improve 502 handling for `comments` stream (#17715) #17506 source snapchat marketing: retry failed request for refreshing access token (#17596) MongoDb Source: Increase performance of discover (#17614) Testing tool commands for run scenarios (#17550) Kustomize: Missing NORMALIZATION_JOB_* environment variables in stable-with-resource-limits overlays (#17713) Fix console errors (#17696) Revert: #17047 Airbyte CDK: Improve error for returning non-iterable from connectors parse_response (#17707) #17047 Airbyte CDK: Improve error for returning non-iterable from connectors parse_response (#17626) 📝 Postgres source: document occasional full refresh under cdc mode (#17705) Bump Airbyte version from 0.40.12 to 0.40.13 (#17682) ...
… from connectors parse_response (airbytehq#17626) * Improve airbyte cdk invalid message data type error message * Test cdk invalid message data type custom error is raised * Fix test to pass stream as a string * Add valid record message data input type test * Add object type and value to AirbyteRecordMessage validator message Co-authored-by: Alexandre Girard <alexandre@airbyte.io>
…iterable from connectors parse_response (airbytehq#17707) * Bump cdk version * Revert "airbytehq#17047 Airbyte CDK: Improve error for returning non-iterable from connectors parse_response (airbytehq#17626)" This reverts commit d9ad272. * Bump
At Airbyte, we seek to be clear about the project priorities and roadmap. This issue has not had any activity for 180 days, suggesting that it's not as critical as others. It's possible it has already been fixed. It is being marked as stale and will be closed in 20 days if there is no activity. To keep it open, please comment to let us know why it is important to you and if it is still reproducible on recent versions of Airbyte. |
This issue was closed because it has been inactive for 20 days since being marked as stale. |
Environment
python3 main.py read
while developing the connectorCurrent Behavior
If the
parse_response
method of the stream does not return an iterator, this leads to a fairly cryptic pydantic error message, instead of specyfing that an iterator is expected. Asresponse.json()
is type hinted withAny
, my IDE did not catch this type violation for me and I was quite confused.Expected Behavior
The error should tell me that the iterator returned from my
parse_response
function is incompatible with the expected data. If there is no use case for returning a dict as an iterator, it could even raise a warning if theparse_response
returns a dict.Logs
Steps to Reproduce
parse_response
methodpython3 main.py read --config secrets/config.json --catalog catalog.json
on itAre you willing to submit a PR?
Sure. From what I can see the method is called from
airbyte/airbyte-cdk/python/airbyte_cdk/sources/streams/http/http.py
Line 428 in bb39b36
Would it make sense to do a type assert here?
The text was updated successfully, but these errors were encountered: