Use platform ?sql param for SQL SELECT#14
Merged
tpellissier-msft merged 2 commits intomainfrom Oct 7, 2025
Merged
Conversation
94adc28 to
6497d40
Compare
zhaodongwang-msft
approved these changes
Oct 7, 2025
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.
Platform PR for ?sql param: https://dev.azure.com/dynamicscrm/OneCRM/_git/CDS/pullrequest/1428003
Copilot Summary:
This pull request updates the SDK to use the native Dataverse Web API
?sql=parameter for read-only SQL queries, replacing the previous approach that routed SQL through a custom API (McpExecuteSqlQuery). The documentation, code comments, and method implementations have been revised accordingly. The changes also improve error handling, clarify supported SQL syntax, and update the quickstart examples to reflect the new approach.Key changes:
1. Migration from Custom API to Web API for SQL queries
query_sqlmethod inDataverseClientand its underlying implementation now execute SQL queries using the Dataverse Web API's?sql=parameter, rather than posting to a custom API endpoint. This includes parsing the SQL to extract the logical table name, resolving it to an entity set, and issuing a GET request with the SQL as a query parameter. Error handling is enhanced, and only a constrained subset of SQL is supported. (src/dataverse_sdk/client.py,src/dataverse_sdk/odata.py) [1] [2]2. Documentation and example updates
README.mdand example scripts have been updated to describe and demonstrate SQL queries via the Web API?sql=parameter, removing mentions of the custom API and clarifying the supported SQL subset. (README.md,examples/quickstart.py,examples/quickstart_pandas.py) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]3. Removal of obsolete configuration
sql_api_nameproperty has been removed fromDataverseConfig, as it is no longer needed for SQL queries. (src/dataverse_sdk/config.py) [1] [2]4. Pandas wrapper adjustments
query_sql_dfmethod in the pandas wrapper now uses the Web API approach and updates its docstrings and comments to match the new SQL query mechanism. (src/dataverse_sdk/odata_pandas_wrappers.py) [1] [2]5. Improved entity set resolution and caching
ODataClient, improving efficiency for repeated SQL queries. (src/dataverse_sdk/odata.py)