Introduce GA API surface: namespace operations, FetchXML paging, streaming queries, and v0→v1 migration tool#175
Conversation
…o v1 - Implemented unit tests for the `list_pages` method in `TestListPages` class, covering various scenarios including iterator return, page content validation, and parameter passing. - Added checks for deprecation warnings to ensure no warnings are raised during the usage of `list_pages`. - Introduced a new migration script `migrate_v0_to_v1.py` to automate the transition from beta (v0) to GA (v1) API calls, including method renaming and argument adjustments. - Created a new `tools` directory to house the migration script.
There was a problem hiding this comment.
Pull request overview
Summary
This PR aligns the SDK with its GA public API contract. It introduces a clean operations namespace,
replaces the flat client.* v0 surface with structured sub-namespaces, adds full FetchXML support
with correct paging cookie handling, and ships a migration tool for existing v0 callers.
Changes
- API surface: v0 removal and v1 namespace introduction
- Record operations (
client.records) - Query operations (
client.query) - FetchXML support (
models/fetchxml_query.py) QueryResult(models/record.py)DataverseModelprotocol (models/protocol.py)- Filter expressions (
models/filters.py) - v0→v1 migration tool (
tools/migrate_v0_to_v1.py) - Tests
- Examples and documentation
Reviewed changes
Copilot reviewed 38 out of 39 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/init.py | Marks tools/ as a Python package for the migration codemod module. |
| tools/migrate_v0_to_v1.py | Adds a LibCST-based codemod to rewrite common v0 API usage to v1 GA patterns. |
| tests/unit/test_records_operations.py | Adds unit tests for records.list_pages(); existing tests cover CRUD/get behaviors. |
| tests/unit/test_query_operations.py | Updates query builder tests to use col() expressions and GA patterns; revises dataframe test expectations. |
| tests/unit/test_phase2_ga.py | Adds regression tests validating QueryResult, builder flat execution, exports, and warning behavior. |
| tests/unit/test_phase3_ga.py | Adds regression tests for GA record APIs (retrieve, list), DataverseModel protocol, and warning suppression. |
| tests/unit/test_phase4_ga.py | Adds regression tests for FetchXML query support, GA-clean warning guarantees, and codemod transforms. |
| tests/unit/test_client.py | Refactors/updates client construction tests and verifies removed flat methods raise AttributeError. |
| tests/unit/test_client_deprecations.py | Updates tests to assert formerly-deprecated flat methods are removed (raise AttributeError). |
| src/PowerPlatform/Dataverse/operations/records.py | Adds DataverseModel overloads, GA retrieve/list/list_pages, and deprecates records.get(). |
| src/PowerPlatform/Dataverse/operations/query.py | Adds query.fetch_xml() plus GA deprecation warnings for odata_* helpers; removes SQL join/select helpers. |
| src/PowerPlatform/Dataverse/operations/dataframe.py | Deprecates dataframe.get() and suppresses internal records.get() deprecation leakage. |
| src/PowerPlatform/Dataverse/operations/batch.py | Deprecates batch.records.get(), adds batch.records.retrieve() and batch.records.list() (single-page). |
| src/PowerPlatform/Dataverse/models/record.py | Introduces QueryResult wrapper and exports it alongside Record. |
| src/PowerPlatform/Dataverse/models/query_builder.py | Removes fluent filter_* methods, adds execute_pages(), changes execute() to return QueryResult, and deprecates by_page flag + to_dataframe(). |
| src/PowerPlatform/Dataverse/models/protocol.py | Adds runtime-checkable DataverseModel protocol for typed entity CRUD integration. |
| src/PowerPlatform/Dataverse/models/fetch_xml_query.py | Adds inert FetchXmlQuery with .execute() and .execute_pages() supporting paging-cookie propagation. |
| src/PowerPlatform/Dataverse/models/init.py | Re-exports col, raw, DataverseModel, and QueryResult. |
| src/PowerPlatform/Dataverse/data/_odata.py | Adds _build_list() to construct single-page multi-record GET requests (used for batch list). |
| src/PowerPlatform/Dataverse/data/_batch.py | Adds _RecordList and resolves it via _build_list() for batch multi-record reads. |
| src/PowerPlatform/Dataverse/client.py | Removes deprecated flat client methods, leaving namespace-based APIs as the GA surface. |
| src/PowerPlatform/Dataverse/claude_skill/dataverse-sdk-use/SKILL.md | Updates guidance/docs for GA patterns and deprecations. |
| .claude/skills/dataverse-sdk-use/SKILL.md | Mirrors GA guidance updates for the Claude skill copy of the SDK usage doc. |
| README.md | Updates public documentation for GA APIs (retrieve/list/list_pages, execute_pages, fetch_xml, deprecations). |
| pyproject.toml | Adds an optional migration extra (libcst) to support the codemod tool. |
| examples/basic/installation_example.py | Updates sample usage to GA retrieve/list calls (currently has a loop-shape bug). |
| examples/basic/functional_testing.py | Updates functional test harness to GA list/list_pages patterns and improves idempotency for table/relationship setup. |
| examples/advanced/walkthrough.py | Updates the walkthrough to use col() expressions, GA paging (execute_pages), and GA read APIs. |
| examples/advanced/sql_examples.py | Removes GA-removed SQL helper usage and updates narrative to recommend sql_columns/manual joins or FetchXML. |
| examples/advanced/prodev_quick_start.py | Updates dataframe querying patterns and improves entity set name resolution for @odata.bind. |
| examples/advanced/fetch_xml.py | Adds an end-to-end FetchXML example script demonstrating .execute() and .execute_pages() usage. |
| examples/advanced/datascience_risk_assessment.py | Updates dataframe extraction to GA builder patterns using col/raw. |
| examples/advanced/dataframe_operations.py | Updates dataframe “get” examples to GA builder patterns using raw/col. |
| examples/advanced/batch.py | Updates batch examples, switches to interactive base_url input, and uses GA batch record methods. |
| examples/advanced/alternate_keys_upsert.py | Makes table/key creation idempotent and updates verification loop to GA records.list(). |
Comments suppressed due to low confidence (1)
pyproject.toml:63
- The migration extra adds a libcst dependency, and the README/tests reference running
python -m tools.migrate_v0_to_v1after installing the package. But thetools/package is outsidesrc/and won’t be included in the wheel with the current setuptoolswhere = ["src"]config, so the module (and any CLI) won’t exist for installed users. Consider moving the codemod undersrc/PowerPlatform/Dataverse/...(or adjusting packaging) and/or adding a console_script entry so the migration tool is actually available when installed.
[project.scripts]
dataverse-install-claude-skill = "PowerPlatform.Dataverse._skill_installer:main"
[project.optional-dependencies]
dev = [
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"black>=23.0.0",
"isort>=5.12.0",
"mypy>=1.0.0",
"ruff>=0.1.0",
]
migration = ["libcst>=1.0.0"]
[tool.setuptools]
package-dir = {"" = "src"}
zip-safe = false
[tool.setuptools.packages.find]
where = ["src"]
include = ["PowerPlatform*"]
namespaces = false
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pdate deprecated methods - Added simple and advanced streaming options in SKILL.md for records.list_pages() and execute_pages(). - Updated QueryBuilder to replace records.get() with records.list() in documentation and method calls. - Improved unit tests to validate new streaming functionality and ensure correct method delegation.
- Changed method name from `fetch_xml` to `fetchxml` across the codebase for consistency. - Updated relevant documentation to reflect the new method name. - Added a new example script for FetchXML usage demonstrating various scenarios. - Adjusted unit tests to accommodate the method name change and ensure proper functionality.
…aging improvements
…ovals; modify prodev_quick_start.py for additional parameter; enhance pyproject.toml for migration tool; refine migrate_v0_to_v1.py documentation and usage instructions.
…ng and warnings; update migration tool for client variable support and manual review detection.
…agination options - Added `include_annotations` parameter to `_RecordGet` and `_RecordList` classes for OData requests. - Updated `_BatchClient` to handle new parameters in batch operations. - Enhanced `_ODataClient` methods to support `include_annotations`, `expand`, `page_size`, and `count` parameters. - Modified `BatchRecordOperations` to pass new parameters in batch record retrieval and listing methods. - Updated `RecordOperations` to include new parameters for retrieving and listing records. - Added unit tests to validate the new functionality for batch operations and record retrieval. - Implemented migration tool updates to handle changes in method signatures and ensure backward compatibility.
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: sagebree <6541424+sagebree@users.noreply.github.com>
Co-authored-by: sagebree <6541424+sagebree@users.noreply.github.com>
Merge conflicts are resolved and the branch now cleanly merges with latest |
…github.com/microsoft/PowerPlatform-DataverseClient-Python into users/sagebree/api_alignment_client_server
Summary
This PR aligns the SDK with its GA public API contract. It introduces a clean operations namespace,
replaces the flat
client.*v0 surface with structured sub-namespaces, adds full FetchXML supportwith correct paging cookie handling, and ships a migration tool for existing v0 callers.
Changes
1. API surface: v0 removal and v1 namespace introduction
All deprecated v0 methods (
create,update,delete,get,list, etc.) havebeen removed from
DataverseClient(~570 lines). The client now exposes three clean namespaces: