feat: reusable odata#173
Draft
NicoleMGomes wants to merge 8 commits into
Draft
Conversation
911c36b to
fd6fbf6
Compare
fd6fbf6 to
1098cf0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Introduces a new
sap_cloud_sdk.core.odatamodule that provides reusable, destination-aware OData v4 abstractions for the SAP Cloud SDK for Python. This PoC lays the foundation for typed, fluent OData clients without requiring code generation at runtime.Key additions:
ODataHttpTransport— synchronous HTTP transport (requests-based) with automatic CSRF token fetching, retry on 403, and status-code–to-exception mapping.AsyncODataHttpTransport— async mirror usinghttpx.AsyncClient, usable as an async context manager with concurrency-safe CSRF token caching.odata_transport_from_destination— factory that wires a resolved BTPDestinationinto anODataHttpTransport, inheriting its auth tokens and ERP headers.ODataEntity— base dataclass for typed entity models (_entity_set,_key_fields,to_dict(),key_dict()).GetAllRequestBuilder,GetByKeyRequestBuilder,CreateRequestBuilder,UpdateRequestBuilder,DeleteRequestBuilder.StructuredQuery— immutable OData v4 query parameter builder ($select,$filter,$orderby,$top,$skip,$expand, custom params).FilterExpression— composable$filterDSL with field comparisons (eq,ne,lt,le,gt,ge,contains,startswith,endswith) and logical combinators (and_,or_,not_).ODataPageIterator— server-driven pagination following@odata.nextLink.CsrfTokenProvider— synchronous CSRF token provider with lazy fetch and invalidation.ODataError,ODataRequestError,ODataNotFoundError,ODataAuthError,ODataDeserializationError,ODataCsrfError.Module.ODATAtelemetry enum value added.docs/proposals/.Related Issue
Closes #
Type of Change
How to Test
uv syncODataHttpTransportwith arequests.Sessionpointing at any OData v4 service and callGetAllRequestBuilder(transport, MyEntity).top(5).execute().odata_transport_from_destination(destination).uv run pytestChecklist
Additional Notes
This is a PoC / foundational PR. The public API surface (especially request builders and entity base class) is intentionally minimal and may evolve based on feedback before a stable release. The
docs/proposals/documents capture the longer-term vision for code generation and client abstractions.