Repository navigation
fix(low-code): support AsyncRetriever in DynamicSchemaLoader - #974
Baz (bazarnov) merged 7 commits into
Conversation
In create_dynamic_schema_loader, the retriever was created with only partition_router but not stream_slicer. This caused AsyncRetriever creation to fail with 'missing required keyword-only argument: stream_slicer' since AsyncRetriever requires stream_slicer as a keyword-only argument while SimpleRetriever accepts partition_router. The fix mirrors the pattern used in create_default_stream, passing both stream_slicer and partition_router when creating the retriever. Resolves #766 Co-Authored-By: bot_apk <apk@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1775066638-fix-dynamic-schema-loader-async-retriever#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1775066638-fix-dynamic-schema-loader-async-retrieverPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
- AsyncRetriever.read_records drives the jobs through stream_slicer.stream_slices() when called without a slice - DynamicSchemaLoader takes the first Mapping record, skipping the slice log message - Reject an AsyncRetriever with a partition_router in DynamicSchemaLoader: only the first record is read, so extra jobs would be orphaned - Add end-to-end discover tests (JSON and CSV downloads), a guard test and a non-record skip test
…hemaLoader, cover the read path
…, cover an empty download
Baz (bazarnov)
left a comment
There was a problem hiding this comment.
Approved. The kwarg change alone was not enough: with it, the loader still crashed on the slice-less read and then on the slice log message. On top of it I added slice-less reads in AsyncRetriever, log-message skipping in DynamicSchemaLoader, stream_slicer passed to AsyncRetriever only, and a clear error for a partition_router on the schema loader's AsyncRetriever. End-to-end discover and read tests cover JSON, CSV (the source-blackbaud-sky-nxt shape from airbytehq/airbyte#66221), empty and failed downloads. The resolver has the same kwarg mismatch; it is tracked in #1181. All required checks are green on this head. Non-required failures are environmental: Check: destination-motherduck fails the same way on recently merged PRs, and Check: source-intercom failed on an Intercom permission-scope response and then on a PyPI install error, while the same commit passed it in run 36409941804. When squash-merging, drop the Co-Authored-By: bot_apk trailer and the stale "passing both stream_slicer and partition_router" line from the first commit message.
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
Summary
AsyncRetrieveris allowed asDynamicSchemaLoader.retrieverin the schema, but it never worked there. There were three separate failures, and fixing only the first one moves the crash one step further:create_dynamic_schema_loaderpassedpartition_router=only, whilecreate_async_retrieverrequiresstream_slicer>>TypeErrorat construction (the error reported in AsyncRetriever cannot be used in DynamicSchemaLoader - parameter name mismatch #766).DynamicSchemaLoaderreads withread_records({}), i.e. without a slice.AsyncRetriever.read_recordsdereferencedstream_slice.cursor_sliceand never created any job >>AttributeError.AsyncRetrieveryields a slice log message before its records, andnext()took that message as the schema record >>TypeError.Changes:
model_to_component_factory.py: passstream_slicertoAsyncRetrieveronly, so other retrievers (including aCustomRetrieverwith its ownstream_slicer) get exactly the kwargs they got before. Reject anAsyncRetrieverwith apartition_routerinsideDynamicSchemaLoaderwith a clearValueError: only the first record is read, so jobs for other partitions would be orphaned and keep holdingmax_concurrent_async_job_countslots. That configuration already failed at construction before this change.async_retriever.py: when called without a slice, create and poll the jobs throughstream_slicer.stream_slices()and read each job slice. Calls with a slice (every stream partition) are unchanged.dynamic_schema_loader.py: skip log messages when taking the first record.SimpleRetrieveronly yields records, so its behaviour is unchanged.Known limits (documented in the
DynamicSchemaLoaderdocstring)max_concurrent_async_job_count, next to the stream's own jobs.Tests
source-blackbaud-sky-nxtshape from source-blackbaud-sky-nxt contribution from allandelmare airbyte#66221), and an empty download.AirbyteTracedException.partition_routerrejection, aCustomRetrieverkeeping its manifeststream_slicer, and log messages being skipped.Out of scope (follow-up issue)
create_http_components_resolverhas the same kwarg mismatch (its partition routerrequest_optionis dropped since 7.0, andAsyncRetrievercannot be used there). It changes resolver HTTP requests, so it is tracked separately: #1181.Fixes #766
Related: https://github.com/airbytehq/oncall/issues/11848
Link to Devin session: https://app.devin.ai/sessions/1035eef80d1f48f6ab01e96589caedb1