Repository navigation
fix: resolve document timestamp type at runtime - #1415
Aaron ("AJ") Steers (aaronsteers) merged 1 commit into
Conversation
👋 Welcome to PyAirbyte!Thank you for your contribution from Kayvan-Zahiri/PyAirbyte! We're excited to have you in the Airbyte community. 💡 Show Tips and TricksTesting This PyAirbyte VersionYou can test this version of PyAirbyte using the following: # Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/Kayvan-Zahiri/PyAirbyte.git@codex/fix-document-runtime-type' pyairbyte --help
# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/Kayvan-Zahiri/PyAirbyte.git@codex/fix-document-runtime-type'PR Slash CommandsAs needed or by request, Airbyte Maintainers can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful ResourcesIf you have any questions, feel free to ask in the PR comments or join our community:
|
|
Kayvan Zahiri (@Kayvan-Zahiri) - Thanks for your contribution! Reviewing now. Heads up: I'm happy to accept this contriubution on |
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped import fix addresses the reported failure, and the regression coverage exercises the affected paths with no blocking issues identified.
No open issues 🎉
What changed in this PR
Fixes document construction and JSON-schema generation by making the timestamp type available to Pydantic at runtime.
Changes:
- Moves the
datetimeimport out ofTYPE_CHECKING, with a targeted lint exemption. - Adds five regression cases covering omitted, null, and ISO timestamps, record rendering, and schema generation.
| File | Description |
|---|---|
| tests/unit_tests/test_documents.py | Adds regression coverage for document validation, rendering, and schema generation. |
| airbyte/documents.py | Makes datetime available for runtime annotation resolution. |
Review effort: Balanced
cccec35
into
airbytehq:main
|
Kayvan Zahiri (@Kayvan-Zahiri) - Approved and merged! Thanks very much for contributing to Airbyte! 🚀 |
Constructing a
Documentor callingDocumentRenderer.render_document()raisesPydanticUserError: Document is not fully defined, even whenlast_modifiedis omitted. Generating the model's JSON schema fails for the same reason: thedatetimemodule is imported only insideTYPE_CHECKING, so Pydantic cannot resolve the field at runtime.Import
datetimeat runtime, with a targeted TC003 exemption documenting the Pydantic requirement. Add five regressions covering omitted and null timestamps, an ISO timestamp, record rendering, and JSON-schema generation.This bug exists on both
mainandrelease-candidate/v1; the patch targetsmainper AGENTS.md.Validation on Python 3.12 with the release branch's frozen development environment:
No live Airbyte sync, database deployment, or paid service was used. Tests run with telemetry disabled. Full integration and generated-documentation suites are outside this validation.