Skip to content

feat: expand Data Fabric entities service [DS-8360]#1616

Open
avichalsri24 wants to merge 4 commits intomainfrom
task/sync_entities_sdk
Open

feat: expand Data Fabric entities service [DS-8360]#1616
avichalsri24 wants to merge 4 commits intomainfrom
task/sync_entities_sdk

Conversation

@avichalsri24
Copy link
Copy Markdown

@avichalsri24 avichalsri24 commented May 7, 2026

Summary

Adds the missing Data Fabric methods on EntitiesService and exposes the full backend parameter set on existing batch methods.

New methods (sync + async):

  • Single-record ops: insert_record, get_record, update_record, delete_record — fire trigger events on each mutation.
  • query_records — structured query with filter_group, sort_options, selected_fields, expansions, expansion_level, aggregates, group_by, joins, binnings, start, limit. Routes to V2 endpoint when binnings is supplied.
  • Attachments: upload_attachment (bytes or path), download_attachment, delete_attachment.
  • Schema: create_entity (with full SQL-type mapping and per-type constraint defaults), delete_entity, update_entity_metadata.
  • import_records for CSV bulk upload.

Existing methods extended:

  • insert_records / update_records / delete_records accept expansion_level and fail_on_first.
  • list_records accepts OData filter / orderby / select / expand / expansion_level and returns EntityRecordsListResponse (a list subclass with total_count / has_next_page / next_cursor).

Bug fixes:

  • Batch operations recover per-record failures from HTTP 400 responses that carry successRecords / failureRecords lists; other non-2xx statuses propagate.
  • Record input is normalized — accepts dicts, Pydantic models, EntityRecord, or any object with __dict__.

Validation:
Client-side checks reject bad entity / field names (regex, length, reserved names) and per-field constraints (type compatibility, value ranges) before any HTTP call.

Backward compatibility:
Public method signatures only gained optional kwargs. EntityRecord.id stays required. list_records return type subclasses list, so iteration / indexing / len() / isinstance(records, list) continue to work.

Test plan

  • pytest packages/uipath-platform/tests/services/test_entities_service.py — 111 pass
  • pytest packages/uipath-platform/tests/ — 1157 pass
  • pytest packages/uipath/tests/ — 1840 pass
  • ruff check, ruff format --check, mypy src tests, lint_httpx_client.py — clean
  • Live smoke against a Data Fabric tenant before release tag

🤖 Generated with Claude Code

Add single-record operations (insert/get/update/delete), structured
query with filters/sort/expansions/aggregates/joins/binnings, file
attachments (upload/download/delete), entity schema management
(create/delete/update metadata), and CSV bulk import — sync and async
variants for each. Existing batch methods now accept expansion_level
and fail_on_first; list_records exposes OData filter/orderby/select/
expand and returns total_count / has_next_page / next_cursor.

Batch operations now recover per-record failures from HTTP 400
responses that carry successRecords/failureRecords lists, so callers
can handle unknown record ids gracefully instead of catching
exceptions.

Client-side validation rejects bad entity / field names (regex,
length, reserved names) and per-type constraints (range checks,
type-vs-constraint compatibility) before any HTTP call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels May 7, 2026
@avichalsri24 avichalsri24 changed the title feat(platform): expand Data Fabric entities service [DS-8360] feat: expand Data Fabric entities service [DS-8360] May 7, 2026
avichalsri24 and others added 2 commits May 7, 2026 17:02
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the Data Fabric EntitiesService surface area by adding missing Data Fabric entity operations (single-record CRUD, structured query, attachments, schema management, bulk import) and by exposing more backend parameters/metadata on existing batch and list endpoints.

Changes:

  • Added new Data Fabric APIs to EntitiesService: single-record CRUD, structured query (V1/V2 routing), attachments, entity schema create/update/delete, and CSV bulk import (sync + async).
  • Extended existing record list/batch operations to support additional backend parameters and richer pagination metadata (EntityRecordsListResponse), plus improved batch error recovery for per-record failures on HTTP 400.
  • Added/updated entity/query/schema models and comprehensive tests for the new behaviors.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/uipath/uv.lock Bumps editable uipath-platform version reference.
packages/uipath-platform/uv.lock Bumps uipath-platform version to 0.1.47.
packages/uipath-platform/pyproject.toml Version bump to 0.1.47.
packages/uipath-platform/src/uipath/platform/entities/entities.py Adds new response/query/schema models (batch failure shape, list response w/ metadata, structured query types).
packages/uipath-platform/src/uipath/platform/entities/_entities_service.py Implements the new/extended EntitiesService methods and request/response helpers.
packages/uipath-platform/src/uipath/platform/entities/init.py Exposes the newly added entities/query/schema symbols via package exports.
packages/uipath-platform/tests/services/test_entities_service.py Adds test coverage for new methods, query routing, attachments, schema creation defaults, and validation/error recovery.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +2494 to +2498
if isinstance(metadata, EntityMetadataUpdateOptions):
body = metadata.model_dump(by_alias=True, exclude_none=True)
else:
body = dict(metadata)
return RequestSpec(
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dict inputs now route through EntityMetadataUpdateOptions.model_validate(...) then model_dump(by_alias=True, exclude_none=True), so display_name/is_rbac_enabled get serialized as displayName/isRbacEnabled on the wire. New test test_update_entity_metadata_normalizes_snake_case_dict_keys locks this in.

"fields": [self._build_schema_field_payload(f) for f in fields],
"folderId": opts.folder_key or DATA_FABRIC_TENANT_FOLDER_ID,
"isRbacEnabled": bool(opts.is_rbac_enabled or False),
"isInsightsEnabled": bool(opts.is_analytics_enabled or False),
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_analytics_enabled → isInsightsEnabled — added a one-line comment at the payload site explaining the legacy wire-name divergence.

Comment on lines +546 to +548
def __getitem__(self, index: int) -> EntityRecord:
"""Index records by position (delegates to ``self.items``)."""
return self.items[index]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added @overload for int and slice on EntityQueryRecordsResponse, so slicing returns List[EntityRecord] and indexing returns EntityRecord with proper type narrowing.

Comment on lines +553 to 556
) -> EntityRecordsListResponse:
"""Asynchronously list records from an entity with optional pagination and schema validation.

The schema parameter enables type-safe access to entity records by validating the
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring now mirrors the sync version: Args list includes expansion_level, filter, orderby, select, expand; Returns describes EntityRecordsListResponse with pagination metadata; Examples include an OData filter/orderby/select/expand sample.

- update_entity_metadata: dict inputs are now validated through
  EntityMetadataUpdateOptions so snake_case keys are converted to the
  camelCase API field names the backend expects (instead of being sent
  through unchanged and silently no-op'ing the update).
- create_entity: comment the user-facing is_analytics_enabled option
  maps to the legacy backend field name isInsightsEnabled.
- EntityQueryRecordsResponse.__getitem__: add @overload for int and
  slice so type checkers reflect actual delegation behaviour.
- list_records_async: docstring Args / Returns now match the sync
  variant (new OData params, EntityRecordsListResponse return type).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

FileContent = Union[bytes, bytearray, memoryview]
"""Acceptable raw bytes types for attachment/CSV uploads."""

_NAME_RE = re.compile(r"^[a-zA-Z]\w*$")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this consistent with backend?

)

return self.validate_entity_batch(response, schema)
async def _do() -> Response:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better name here.

),
)

def _query_records_spec(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!! You are swapping out the query_records_spec which is catering to FQS query endpoint from DataService. This breaks multiple APIs for agents. Right strategy to avoid this is:

  1. Isolate the changes for schema into EntitySchemaService
  2. Isolate the changes for data into EntityDataService.
  3. EntityService is a facade that doesnt change the external contract.
  4. Carefully understand the APIs for DS and FQS and then make these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants