feat(entities): optional source header on datafabric query/execute#1808
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an optional source argument to the Entities federated SQL query APIs so callers can opt into sending x-uipath-source on the datafabric_/api/v1/query/execute request.
Changes:
- Add optional
source: Optional[str]toEntitiesService.query_entity_records/query_entity_records_async. - Thread
sourcethroughEntityDataServiceand emitx-uipath-sourceonly for the query/execute endpoint viaRequestSpec.headers. - Add tests validating header presence/absence for the sync query path.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/uipath-platform/tests/services/test_entities_service.py | Adds tests asserting x-uipath-source header behavior for sync query_entity_records. |
| packages/uipath-platform/src/uipath/platform/entities/_entity_data_service.py | Threads optional source through query helpers and attaches it as x-uipath-source in the query/execute RequestSpec. |
| packages/uipath-platform/src/uipath/platform/entities/_entities_service.py | Extends public query APIs with optional source and documents the header behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
476
to
477
| @pytest.mark.anyio | ||
| async def test_query_entity_records_async_rejects_invalid_sql_before_network_call( |
Add an optional `source` parameter to query_entity_records[_async]. When set, it becomes the `x-uipath-source` request header on the datafabric query/execute call, identifying the calling surface (e.g. LOW_CODE_AGENT). Omitted when unset; no other entity endpoint is affected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3d887b6 to
5643def
Compare
UIPath-Harshit
approved these changes
Jul 13, 2026
…ource-header # Conflicts: # packages/uipath-platform/src/uipath/platform/common/constants.py
Version carrying the optional `source` parameter on query_entity_records[_async] (the `x-uipath-source` header on datafabric query/execute), so consumers can pin the version that has it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
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.



Summary
Adds an optional
sourceparameter toEntitiesService.query_entity_records/query_entity_records_async. When provided, it is sent as thex-uipath-sourcerequest header onPOST datafabric_/api/v1/query/execute, identifying the calling surface (e.g.LOW_CODE_AGENT).Why
Companion to CommonEntityPlatform #5611: FQS types relationship (FK) fields as their underlying scalar id — so a raw-SQL join
relationshipField = Other.Idvalidates and executes — only when the request carriesx-uipath-source: LOW_CODE_AGENT. This change lets a caller (e.g. the Data Fabric agent tool in uipath-langchain-python) opt into that typing.Scope
sourceis passed, and only in_query_entity_records_spec— the sole builder for the query/execute endpoint._query_entities_for_records[_async]now forwardspec.headers.sourcesends nox-uipath-source(behavior unchanged for all existing callers).Tests
sourceprovided →x-uipath-sourceheader present on the request.source) → header absent.🤖 Generated with Claude Code