Skip to content

Commit a870646

Browse files
allenkim0129hamshavathimunibyraiahpvaneckweshaggardw-javed
committed
Add 'change_feed_mode' to 'query_items_change_feed' API (Azure#38105)
* Add 'change_feed_mode' to 'query_items_change_feed' API * remove unnecessary import * Fix lint * Updated CHANGELOG.md * Removed _feed_range.py * Addressed comments * Fixed lint * Add kwargs back to 'call'QueryItemsChangeFeed' * Fixed syntax error with f-string * Removed StrEnum to support earlier Python versions * Fixed f-string error * addressed comments * Addressed comments Also, enabled AllVersionsAndDelete mode for emulators * Removed unnecessary tests * Fix tests for emulator * Generating SDK with model renames (Azure#38108) * Generating SDK with model name updates * Fixing the missed api name change for SDT * Updated the TypeSpec and re-generated the SDK with TranslationStatus id as string * Fixing TranslationIds and DocumentIds renames in patched methods * Updating changelog * [Identity][Monitor] Update live test setup (Azure#37943) Signed-off-by: Paul Van Eck <[email protected]> * Clean-up cosmos test pipeline (Azure#38126) Update cosmos test pipeline as it no longer needs that sub-config as the data comes from the service connection. Also update the config name to use default name of public. * Multi modal eval fix (Azure#38134) * Initial-Commit-multimodal * Fix * Sync eng/common directory with azure-sdk-tools for PR 9092 (Azure#37713) * Export the subscription data from the service connection * Update deploy-test-resources.yml --------- Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Wes Haggard <[email protected]> * Removing private parameter from __call__ of AdversarialSimulator (Azure#37709) * Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Remove private variable and use kwargs * Add experimental tag to adv sim --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> * Enabling option to disable response payload on writes (Azure#37365) * Initial draft * Adding tests * Renaming parameter * Update container.py * Renaming test file * Fixing LINT issues * Update container.py * Update _base.py * Update _base.py * Fixing tests * Fixing tests * Adding support to disable response payload on write for AIO * Update CHANGELOG.md * Update _cosmos_client.py * Reacting to code review comments * Addressing code review feedback * Addressed CR feedback * Fixing pyLint errors * Fixing pylint errors * Update test_crud.py * Fixing svc regression * Update sdk/cosmos/azure-cosmos/azure/cosmos/aio/_container.py Co-authored-by: Anna Tisch <[email protected]> * Reacting to code review feedback. * Update container.py * Update test_query_vector_similarity.py --------- Co-authored-by: Anna Tisch <[email protected]> * deprecate azure_germany (Azure#37654) * deprecate azure_germany * update * update * Update sdk/identity/azure-identity/azure/identity/_constants.py Co-authored-by: Paul Van Eck <[email protected]> * update --------- Co-authored-by: Paul Van Eck <[email protected]> * Add default impl to handle token challenges (Azure#37652) * Add default impl to handle token challenges * update version * update * update * update * update * Update sdk/core/azure-core/azure/core/pipeline/policies/_utils.py Co-authored-by: Paul Van Eck <[email protected]> * Update sdk/core/azure-core/azure/core/pipeline/policies/_utils.py Co-authored-by: Paul Van Eck <[email protected]> * update * Update sdk/core/azure-core/tests/test_utils.py Co-authored-by: Paul Van Eck <[email protected]> * Update sdk/core/azure-core/azure/core/pipeline/policies/_utils.py Co-authored-by: Paul Van Eck <[email protected]> * update --------- Co-authored-by: Paul Van Eck <[email protected]> * Make Credentials Required for Content Safety and Protected Materials Evaluators (Azure#37707) * Make Credentials Required for Content Safety Evaluators * fix a typo * lint, fix content safety evaluator * revert test change * remove credential from rai_service * addFeedRangesAndUseFeedRangeInQueryChangeFeed (Azure#37687) * Add getFeedRanges API * Add feedRange support in query changeFeed Co-authored-by: annie-mac <[email protected]> * Update release date for core (Azure#37723) * Improvements to mindependency dev_requirement conflict resolution (Azure#37669) * during mindependency runs, dev_requirements on local relative paths are now checked for conflict with the targeted set of minimum dependencies * multiple type clarifications within azure-sdk-tools * added tests for new conflict resolution logic --------- Co-authored-by: McCoy Patiño <[email protected]> * Need to add environment to subscription configuration (Azure#37726) Co-authored-by: Wes Haggard <[email protected]> * Enable samples for formrecognizer (Azure#37676) * multi-modal-changes * fixes * Fix with latest * dict-fix * adding-protected-material * adding-protected-material * adding-protected-material * bumping-version * adding assets * Added image in simulator * Added image in simulator * bumping-version * push-asset * assets * pushing asset * remove-containt-on-key * asset * asset2 * asset3 * asset4 * adding conftest * conftest * cred fix * asset-new * fix * asset * adding multi-modal-without-tests * asset-from-main * asset-from-main * fix * adding one test only * new asset * tests,fix: Sanitizer should replace with enum value not enum name * test-asset * [AutoRelease] t2-containerservicefleet-2024-09-24-42036(can only be merged by SDK owner) (Azure#37538) * code and test * Update CHANGELOG.md * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-dns-2024-09-25-81486(can only be merged by SDK owner) (Azure#37560) * code and test * update-testcase * Update CHANGELOG.md * Update test_mgmt_dns_test.py --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-appconfiguration-2024-10-09-68726(can only be merged by SDK owner) (Azure#37800) * code and test * update-testcase * Update pyproject.toml --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> * code and test (Azure#37855) Co-authored-by: azure-sdk <PythonSdkPipelines> * [AutoRelease] t2-servicefabricmanagedclusters-2024-10-08-57405(can only be merged by SDK owner) (Azure#37768) * code and test * update-testcase * update-testcases --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-containerinstance-2024-10-21-66631(can only be merged by SDK owner) (Azure#38005) * code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [sdk generation pipeline] bump typespec-python 0.36.1 (Azure#38008) * update version * update package.json * [AutoRelease] t2-dnsresolver-2024-10-12-16936(can only be merged by SDK owner) (Azure#37864) * code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> * new asset after fix in conftest * asset * chore: Update assets.json * Move perf pipelines to TME subscription (Azure#38020) Co-authored-by: Wes Haggard <[email protected]> * fix * after-comments * fix * asset * new asset with 1 test recording only * chore: Update assets.json * conftest fix * assets change * new test * few changes * removing proxy start * added all tests * asset * fixes * fixes with asset * asset-after-tax * enabling 2 more tests * unit test fix * asset * new asset * fixes per comments * changes by black * merge fix * pylint fix * pylint fix * ground test fix * fixes - pylint, black, mypy * more tests * docstring fixes * doc string fix * asset * few updates after Nagkumar review * fix * fix mypy --------- Co-authored-by: Azure SDK Bot <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Fabian Meiswinkel <[email protected]> Co-authored-by: Anna Tisch <[email protected]> Co-authored-by: Xiang Yan <[email protected]> Co-authored-by: Paul Van Eck <[email protected]> Co-authored-by: Neehar Duvvuri <[email protected]> Co-authored-by: Annie Liang <[email protected]> Co-authored-by: annie-mac <[email protected]> Co-authored-by: Scott Beddall <[email protected]> Co-authored-by: McCoy Patiño <[email protected]> Co-authored-by: kdestin <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> * azure-ai-evaluation release 1.0.0b5 2024-10-28 (Azure#38138) * Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> * open apiview for mgmt sdk (Azure#38143) * [AutoRelease] t2-appplatform-2024-10-25-72111(can only be merged by SDK owner) (Azure#38092) * code and test * changelog * changelog * changelog * Update CHANGELOG.md * Update _version.py * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * AzurePipelinesCredential | adding mlflow uri func (Azure#36580) * Bug 3323988: Regex fix and indices correction for model download * fixing test case * adding mlflow tracking uri func * passing service context to azureml mlflow * final flow APC complete * modify host_url * fixing unit test cases * changing mock for urlparse * fixing the log msg * Update changelog (Azure#38133) * Increment package version after release of azure-ai-evaluation (Azure#38142) * Remove psycopg2-binary from dev_requirements.txt (Azure#38103) Remove psycopg2-binary from dev_requirements.txt * [Evaluation] Error improve for service-based evaluator/simulator (Azure#38106) * Error improve for service-based evaluator/simulator * update * update print summary * update * fix failed tests * fix black * update changelog * update * update version * AzMon exporter: Serialize complex log bodies to json and set dependency type to `gen_ai.system` instead of N/A (Azure#37694) * Serialize complex log bodies to json and support gen_ai.system * Experimental tags on ADV scenarios (Azure#38166) * Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs * Update chanagelog * Experimental tags on adv scenarios --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> * Sync eng/common directory with azure-sdk-tools for PR 9259 (Azure#38160) * Run perf tests under federated auth Run the tests under the same federated auth used to deploy the tests and setup the variables needed to configure AzurePipelineCredential. * Fix indention for working directory --------- Co-authored-by: Wes Haggard <[email protected]> * Re-generated REST client after re-copying Swagger folder for `2024-10-01-preview`. (Azure#38003) - Re-copied Swagger folder from https://github.com/Azure/azure-rest-api-specs/tree/release-machinelearningservices-Microsoft.MachineLearningServices-2024-10-01-preview/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview - Up to Azure/azure-rest-api-specs@4a10268 - Re-generated REST client for `v2024-10-01-preview` - Unit and e2e tests (in Live mode) passed for feature `workspaces` (Details in PR) Co-authored-by: Jing Li <[email protected]> * [Evaluation] Change RougeType to Enum (Azure#38131) * Change RougeType to Enum * update test recording * update assets.json * try to update recordings to fix the failed tests * update * revert assets.json * update * Auto-enable Azure AI Inference instrumentation in Azure Monitor, update docs (Azure#38071) * Auto-enable Azure AI Inference instrumentation in Azure Monitor, update docs * [AutoRelease] t2-redhatopenshift-2024-10-30-81004(can only be merged by SDK owner) (Azure#38181) * code and test * update-testcase * Update CHANGELOG.md * Update _meta.json --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-resourcehealth-2024-10-30-72592(can only be merged by SDK owner) (Azure#38186) * code and test * update-testcase * update-testcases * update-testcases --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-appconfiguration-2024-10-30-38914(can only be merged by SDK owner) (Azure#38177) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-databox-2024-10-30-61405(can only be merged by SDK owner) (Azure#38182) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-edgeorder-2024-10-30-57522(can only be merged by SDK owner) (Azure#38178) * code and test * update-testcase * update-testcases --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-extendedlocation-2024-10-30-79235(can only be merged by SDK owner) (Azure#38176) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-digitaltwins-2024-10-30-74766(can only be merged by SDK owner) (Azure#38179) * code and test * update-testcase * Rename test_azure_mgmt_digitaltwins_test.py to disable_test_azure_mgmt_digitaltwins_test.py * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * Added get_arm_info (Azure#38018) * Added get_arm_info * update * update * Update * Update release date * update * Update CHANGELOG.md (Azure#38170) One column name updated to "New `max_token` for Generation" in CHANGLOG.md * Minor Readme fix (Azure#38191) * Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs * Update chanagelog * Experimental tags on adv scenarios * Readme fix onbreaking change --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> * Minor fixes in vanilla OTel tracing sample (Azure#38194) * Minor fixes in OTel tracing samples * Add test for get_arm_endpoints (Azure#38196) * Add overloads for __call__ methods that accept query/response and conversation (Azure#38097) * Add overloads for __call__ methods that take query/response and conversation * remove callable type hint * add docstrings/type hints * fix a typo * remove file * remove a bad param * add docs for relevance * fix some missing type hints * lint and run black * merge with main * fix some mypy errors, not all pylint * fix black errors * attempt to fix tests * fix retrieval * fix up tests and lint * fix some docstrings to mark some things as optional * [Monitor] Apply black formatting (Azure#38129) Signed-off-by: Paul Van Eck <[email protected]> * [CI] Update autorest CI to use Python 3.9 (Azure#38175) Signed-off-by: Paul Van Eck <[email protected]> * Eval qr json lines now has context from both turns and category if it exists (Azure#38199) * Update task_query_response.prompty remove required keys * Update task_simulate.prompty * Update task_query_response.prompty * Update task_simulate.prompty * Fix the api_key needed * Update for release * Black fix for file * Add original text in global context * Update test * Update the indirect attack simulator * Black suggested fixes * Update simulator prompty * Update adversarial scenario enum to exclude XPIA * Update changelog * Black fixes * Remove duplicate import * Fix the mypy error * Mypy please be happy * Updates to non adv simulator * accept context from assistant messages, exclude them when using them for conversation * update changelog * pylint fixes * pylint fixes * remove redundant quotes * Fix typo * pylint fix * Update broken tests * Include the grounding json in the manifest * Fix typo * Come on package * Release 1.0.0b5 * Notice from Chang * Remove adv_conv template parameters from the outputs * Update chanagelog * Experimental tags on adv scenarios * Readme fix onbreaking change * Add the category and both user and assistant context to the response of qr_json_lines * Update changelog --------- Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> * Fix doc issues (Azure#38204) * Evaluation: Remove `parallel` from composite evaluators (Azure#38168) * Remove `parallel` from composite evaluators * update recording * update * output_dir check * fix the test recording * fix the failed unit-test * update changelog * update * fix black issue * revert output_path related change * Update sdk/evaluation/azure-ai-evaluation/CHANGELOG.md Co-authored-by: Neehar Duvvuri <[email protected]> --------- Co-authored-by: Neehar Duvvuri <[email protected]> * [Core] Allow operation-level tracing attributes (Azure#38164) Our documentation advertises that the `tracing_attributes` keyword argument can be passed in at both the client constructor level and the operation/method level. This makes this actually the case. Per-operation customization of tracing attributes can help users mark/identify spans from specific operations when spans are handled through custom span processors. Signed-off-by: Paul Van Eck <[email protected]> * Sync eng/common directory with azure-sdk-tools for PR 9281 (Azure#38213) * package-properties are now populated with matrix configurations from their ci.yml if present * create new code path for generate-job-matrix.yml which combines Create-JobMatrix and the "distribute-packages-to-matrix" action to generate dynamic matrices for PRs --------- Co-authored-by: Scott Beddall <[email protected]> * Sync eng/common directory with azure-sdk-tools for PR 9290 (Azure#38223) * identify and resolve missing function GenerateMatrixForConfig * identify and resolve miss-used null-coalesce operator --------- Co-authored-by: Scott Beddall <[email protected]> * update (Azure#38220) * [AutoRelease] t2-containerservicefleet-2024-10-31-68497(can only be merged by SDK owner) (Azure#38221) * code and test * update-testcase * format * reformat --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> * [BatchAI] deprecate azure-mgmt-batchai (Azure#38226) * [ModelsRepository] deprecating azure-iot-modelrepository (Azure#38225) * [ModelsRepository] deprecating iot-modelrepository * add changelog section * [ServerManager] deprecating azure-mgmt-servermanager (Azure#38229) * [DocumentDB] deprecate azure-mgmt-documentdb (Azure#38227) * [EH/SB] ran black (Azure#38210) * ran black * fix pylint * black sb * pylint * spacing * Update randomization pattern for Adversarial simulation (Azure#38211) * Update randomization pattern for Adversarial simulation * update changelog * amqp msg (Azure#38122) * Implement live metrics filtering for charts (part 1) (Azure#37998) * Update CODEOWNERS for graphrbac owner (Azure#38236) Updating the owner of graphrbac to Laurent as Yuchao said they are not the owners. * Multi modal docstring improvements (Azure#38193) * docstring-update * doc string updates * doc string updates * Increment package version after release of azure-core (Azure#38240) * kwarg type hints (Azure#38214) * [Evaluation] add environment variable for API token refresh rate (Azure#38162) * use env var for azure token refresh interval * update changelog and set default value for env var * cast refresh rate to int * fix pylint error * fix tox black issue * [Evaluation] Default to non-randomized order of template parameters (Azure#38239) * Default to non-randomized order of template parameters * small changelog update * resolve issue with language-settings handling additional service changes (Azure#38216) * Reduce unnecessary delete calls to ARM for storage accounts (Azure#38246) Co-authored-by: Ben Broderick Phillips <[email protected]> * clean up unused python script (Azure#38128) * Sync eng/common directory with azure-sdk-tools for PR 9288 (Azure#38243) * Update Logging * Update eng/common/scripts/logging.ps1 --------- Co-authored-by: Chidozie Ononiwu <[email protected]> Co-authored-by: Wes Haggard <[email protected]> * [Scheduler] deprecate azure-mgmt-scheduler (Azure#38228) * [ServiceManagement] deprecate azure-servicemanagement-legacy (Azure#38230) * [GraphRBAC] deprecating package (Azure#38224) * [GraphRBAC] updating docs to point to replacement repo * update version file * fix link * Enable py2docfx docs gen tool, remove the dockerimage docs validation (Azure#38085) * Enable py2docfx docs gen tool, remove the dockerimage docs validation * Remove the --no-venv-required flag from the command line which was a leftover copy/paste from the original PR * Change the version to a pre-release for testing as the released version doesn't appear to have these changes * Update py2docfx version since previous version had problems on Linux * Change the python command to add -u so the sdtout and stderr streams are unbuffered and we see the full output * Updates for feedback and to see what's going on with the output * Remove the Get-Content line which should have been removed in the last commit * Print the command output on actual different lines * Finish the sentence in the comment * Sync eng/common directory with azure-sdk-tools for PR 9294 (Azure#38251) Co-authored-by: Scott Beddall <[email protected]> * [core] add servicemanagement legacy to ci for release (Azure#38253) * Session Token Management APIs (Azure#36971) * merge from main and resolve conflicts * remove async keyword from changeFeed query in aio package * refactor * refactor * fix pylint * added public surface methods * pylint fix * fix * added functionality for merging session tokens from logical pk * fix mypy * added tests for basic merge and split * resolve comments * resolve comments * resolve comments * resolve comments * fix pylint * fix mypy * fix tests * add tests * fix pylint * fix and resolve comments * fix and resolve comments * Added isSubsetFeedRange logic * Added request context to crud operations, session token helpers * revert unnecessary change * Added more tests * Added more tests * Changed tests to use new public feed range and more test coverage for request context * Added more tests * Fix tests and add changelog * fix spell checks * Added tests and pushed request context to client level * Added async methods and removed feed range from request context * fix tests * fix tests and pylint * Reacting to comments * Reacting to comments * pylint and added hpk tests * reacting to comments * fix tests and mypy * fix mypy * fix mypy * reacting to comments * reacting to comments * reacting to comments * fix cspell * rename method to get_latest_session_token * reacting to reverted feed range * change based on the api review * Reacting to API review and adding samples. * Fixed pylint * Reacting to comments * Reacting to comments * Reacting to comments * Reacting to comments * Fix pydoc * Fix pydoc * reacting to comments * reacting to comments --------- Co-authored-by: annie-mac <[email protected]> * [AutoRelease] t2-network-2024-10-31-29845(can only be merged by SDK owner) (Azure#38235) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [ServiceBus/EventHub] add service specific message annotations to receiver logs (Azure#38090) * [ServiceBus] add service specific message annotations to receiver logs * add to eventhub + update readme logging to include thread formatting * only log service annotations header props * move logging to sdk layer * move msg logging into eh consumer * remove sb pyamqp recvr logs * black * Updating CODEOWNERS for Synapse (Azure#38255) Wan Yang no longer uses the @wonner alias and uses @wanyang7. * Evaluation: Fix the `output_path` parameter of `evaluate` API doesn't support relative path (Azure#38241) * Fix output_path parameter doesn't support relative path * add comments * fix the test * update * minor update * update * [synapse] deprecate azure-synapse (Azure#38262) * [Synapse] deprecation azure-mgmt-synapse * update synapse rel date * [DocumentDB] update deprecation release date (Azure#38265) * [CognitiveServices] deprecate vision packages (Azure#38206) * deprecate computervision * deprecate vision face * contentmoderator * update release date * update changelog date * update release date * customvision * RAI service input sanitization (Azure#38247) * escape eval inputs * new recordings and disable accidentally enabled test * save recordings again * save recordings again again * save recordings again again again * update groundedness threshold * Update sdk/evaluation/azure-ai-evaluation/tests/e2etests/test_builtin_evaluators.py Co-authored-by: Billy Hu <[email protected]> * correct new check --------- Co-authored-by: Billy Hu <[email protected]> * pass params from ci.yml to cosmos-sdk-client appropriately (Azure#38272) * Fix __call__ Overload Types (Azure#38238) * Fix __call__ overload issues * fix typing issue * make query required for groundednesspro * fix a malformatted docstring * fix some type hints and remove eval_last_turn from evaluators * fix optional import * comment out eval last turn section * Update deprecation_process.md (Azure#38270) Adding a section on: - adding the artifact to the ci before release - skipping checks for other failing packages in the pipeline for release if needed * [DocumentDB] add changelog to manifest.ini (Azure#38273) * [evaluation] Add support for using evaluate() with evaluators that have missing inputs (Azure#38276) * Update evaluate to allow optional params + add tests * Record tests * Exclude optional params from 'missing inputs' warning * Add tests * Record tests * Fix linting errors * Merge from main and fix linting error * Add unit test for missing output * Update convo test to assert per turn results * Run linting * Add test data * Re-record test * disabled black in pyproject.toml for all packages (Azure#38271) * [AutoRelease] t2-postgresqlflexibleservers-2024-10-30-49242(can only be merged by SDK owner) (Azure#38188) * code and test * update-testcase * Update CHANGELOG.md * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-devtestlabs-2024-11-04-17468(can only be merged by SDK owner) (Azure#38286) * code and test * update-testcase * update changelog * Update CHANGELOG.md * Update _version.py * Update setup.py --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-sql-2024-10-03-42323(can only be merged by SDK owner) (Azure#37698) * code and test * Update CHANGELOG.md * Update sdk/sql/azure-mgmt-sql/CHANGELOG.md * Update sdk/sql/azure-mgmt-sql/CHANGELOG.md * update-testcase * fix generated samples * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * [EventHub] add ssl_context kwarg to clients (Azure#37702) * remove verify from pyamqp JWTToken * add ssl_context kwarg * add tests * fix merge * fix failing/lint/mypy * lint * separate ssl_context property from conn verify * make sb changes * add tests * changelog * black * Update CHANGELOG.md (Azure#38301) * download_file is fully annotated (Azure#38284) * Release azure-monitor-opentelemetry-exporter (Azure#38310) * Increment package version after release of azure-monitor-opentelemetry (Azure#38308) * Eval/bugfix/content safety parallel (Azure#38307) * fix cs eval * recordings and cl * target newly released proxy version (Azure#38282) Co-authored-by: Scott Beddall <[email protected]> * [Storage] Added connection pool note to `max_concurrency` kwarg for upload/download APIs (Azure#38254) * Sync eng/common directory with azure-sdk-tools for PR 9308 (Azure#38311) Remove unnecessary Resolve-Path in Get-PrPkgProperties Co-authored-by: Scott Beddall <[email protected]> * Version/location updates for stress script usage (Azure#38281) Co-authored-by: Ben Broderick Phillips <[email protected]> * [AutoRelease] t2-loganalytics-2024-11-04-45063(can only be merged by SDK owner) (Azure#38292) * code and test * update-testcase * fix generated samples * update version --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-automation-2024-11-04-74277(can only be merged by SDK owner) (Azure#38294) * code and test * update-testcase * Update CHANGELOG.md --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * Broker on mac support (Azure#38274) * Broker on mac support * update * update * update * update * update * update readme * update * Add firewallsku as ManagedNetwork property (Azure#37885) * Generated REST client for upcoming API version `v2024-10-01-preview`. - Created Swagger folder `2024-10-01-preview` by copying from the same one in GitHub project `azure-rest-api-specs` - https://github.com/Azure/azure-rest-api-specs/tree/release-machinelearningservices-Microsoft.MachineLearningServices-2024-10-01-preview/specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview - Up to Azure/azure-rest-api-specs#30776 - Safe to merge in for not bumping up callers' API versions with it - Cannot bump up before registering it for RPs in selected regions - Added tag `v2024-10-01-preview` to `readme.md` - Generated REST client for `v2024-10-01-preview` * Initial commit * Initial commit * add new test for firewallsku * add new test for firewallsku * remove irrelevant changes * add addressprefix changes * address review comments * address review comments * reset the file in rest client * address review comments --------- Co-authored-by: Jing Li <[email protected]> Co-authored-by: Nethra Sashikar <[email protected]> * [AutoRelease] t2-managementgroups-2024-11-04-45946(can only be merged by SDK owner) (Azure#38291) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-managedservices-2024-11-04-44075(can only be merged by SDK owner) (Azure#38287) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-marketplaceordering-2024-11-04-08673(can only be merged by SDK owner) (Azure#38288) * code and test * update-testcase * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-servicebus-2024-11-04-58886(can only be merged by SDK owner) (Azure#38293) * code and test * update-testcase * update version --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: msyyc <[email protected]> * [Synapse] azure-synapse post deprecation (Azure#38315) * [Cognitive Services] vision post-deprecation (Azure#38304) * [Cognitive Services] vision post-deprecation * black on active cs packages * [Cosmos] documentdb post deprecation (Azure#38314) * [sdk generation pipeline] fix logic to extract swagger file (Azure#38334) * fix logic to extract swagger file * fix logic to extract swagger file * Update deprecation_process.md for Verify Readmes failure (Azure#38333) Adding a section for Verify Readmes failure following Azure#37975 . * Increment package version after release of azure-identity-broker (Azure#38337) * Edit pass on Azure Identity Broker README (Azure#38339) * Edit pass on Azure Identity Broker README * Change version * [Core] Deprecate OpenCensus tracing plugin (Azure#37975) Signed-off-by: Paul Van Eck <[email protected]> * [Core] servicemanagement-legacy post deprecation (Azure#38319) * Prompt support for Inference SDK (Azure#37917) * Prompty support within Azure AI Inference SDK * Fix unit test * Address PR feedback with copyright, merge PromptConfig to PromptTemplate * Add comment and set model_name as optional * Bug fixes * Updated parameter names from PM feedbacks * Improve sample code and unit tests * Update readme and comments * Rename files * Address PR comment * add Pydantic as dependency * Fix type errors * Fix spelling issues * Address PR comments and fix linter issues * Fix type import for "Self" * Change to keyword-only constructor and fix linter issues * Rename function `from_message` to `from_str`; `render` to `create_messages` * Change from `from_str` to `from_string` * Merge latest code from `microsoft/prompty` and resolve linter issues * Fix PR comment * Fix PR comments * Remove a defunct variable from docindex.yml (Azure#38342) * Fix errors from sphinx and mypy * Changed parameter to `mode` Since `change_feed_mode` was only used for `query_items_change_feed`, it doesn't have to be specified. `mode` should be good enough. * Fixed typo * Changed 'mode' to be string type * Reverted necessary type def * Addressed comments * Added samples for change_feed_mode * Addressed comments * Removed unnecessary docstring * Remove mode if 'continuation' was in override definition * add test samples tracking (Azure#38502) * add test samples tracking * add samples tracking to csv/html/md reports * fix for catastrophic pipeline failure * Add OpenTelemetry LoggingHandler conditionally (Azure#38549) * Add helpers to log a GitHub "notice" (Azure#38574) Co-authored-by: Mike Harder <[email protected]> * [AutoRelease] t2-cosmosdb-2024-11-14-60943(can only be merged by SDK owner) (Azure#38531) * code and test * update-testcase --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-mysqlflexibleservers-2024-11-05-47456(can only be merged by SDK owner) (Azure#38329) * code and test * update-testcase * update-format --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> * [AutoRelease] t2-netapp-2024-11-08-58381(can only be merged by SDK owner) (Azure#38411) * code and test * Update CHANGELOG.md * Update CHANGELOG.md * assets * update-format --------- Co-authored-by: azure-sdk <PythonSdkPipelines> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Audunn Baldvinsson <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> * Shrike (Azure#38560) * Datastore auth bug (Azure#38586) * Increment package version after release of azure-search-documents (Azure#38593) * Merge App Config Provider Beta to Main (Azure#38579) * Revert "Remove Telemetry from main (Azure#37783)" (Azure#37812) This reverts commit a65dfb2. * Allocation Id (Azure#37840) * Adding Telemetry * Telemetry Support * fixing formatting * Update _azureappconfigurationprovider.py * Update _azureappconfigurationproviderasync.py * formatting * changing doc style due to pylint-next * fixing kwargs docs * Formatting * Review comments * Changed label checking. * black format changes * pylint * Update sdk/appconfiguration/azure-appconfiguration-provider/azure/appconfiguration/provider/_azureappconfigurationprovider.py Co-authored-by: Avani Gupta <[email protected]> * added space checks * Update conftest.py * moved telemetry to client wrapper * fixing format * updating after merge * fixing black issue * removing unused imports * AllocationId * Update CODEOWNERS * Update CODEOWNERS * fixing issues * Update _client_manager_base.py * Fixing configuration value empty in calc * fixing pylint * Update _constants.py * review comments * fixing allocation check * format fix --------- Co-authored-by: Avani Gupta <[email protected]> * Python Provider 2.0.0b2 Changelog update (Azure#37860) * Update CHANGELOG.md * Update CHANGELOG.md * Increment package version after release of azure-appconfiguration-provider (Azure#37877) * Update _client_manager_base.py (Azure#38019) * App Config Allocation Id Update (Azure#38065) * updated calc to sort keys * Update CHANGELOG.md * Allocation id update (Azure#38242) * updated calc to sort keys * Update CHANGELOG.md * Update _client_manager_base.py * Update CHANGELOG.md (Azure#38521) * Increment package version after release of azure-appconfiguration-provider (Azure#38553) * Removing Allocation ID (Azure#38555) * Removing Allocation ID * Remove constants * Update _client_manager_base.py --------- Co-authored-by: Avani Gupta <[email protected]> Co-authored-by: Azure SDK Bot <[email protected]> * batching adjustments for create-prjobmatrix (Azure#38597) Co-authored-by: Scott Beddall <[email protected]> * [EG] resource notification event (Azure#38100) * rn * update * update * bump * black * Updated doc strings * Merged main * Addressed comments * Revert "Merged main" This reverts commit 217dabc. * Added comment why it is safe to raise exception if mode was missing * Added comment why it is safe to raise exception if mode was missing * Moved the feature update log under unreleased features * Add missing period in changelog --------- Signed-off-by: Paul Van Eck <[email protected]> Co-authored-by: hamshavathimunibyraiah <[email protected]> Co-authored-by: Paul Van Eck <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Waqas Javed <[email protected]> Co-authored-by: Azure SDK Bot <[email protected]> Co-authored-by: Wes Haggard <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Fabian Meiswinkel <[email protected]> Co-authored-by: Anna Tisch <[email protected]> Co-authored-by: Xiang Yan <[email protected]> Co-authored-by: Neehar Duvvuri <[email protected]> Co-authored-by: Annie Liang <[email protected]> Co-authored-by: annie-mac <[email protected]> Co-authored-by: Scott Beddall <[email protected]> Co-authored-by: McCoy Patiño <[email protected]> Co-authored-by: kdestin <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: ChenxiJiang333 <[email protected]> Co-authored-by: Yuchao Yan <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Kshitij Chawla <[email protected]> Co-authored-by: sanchez-alex <[email protected]> Co-authored-by: Leighton Chen <[email protected]> Co-authored-by: Billy Hu <[email protected]> Co-authored-by: Liudmila Molkova <[email protected]> Co-authored-by: Nagkumar Arkalgud <[email protected]> Co-authored-by: Jing Li <[email protected]> Co-authored-by: Jing Li <[email protected]> Co-authored-by: changliu2 <[email protected]> Co-authored-by: Yalin Li <[email protected]> Co-authored-by: Scott Beddall <[email protected]> Co-authored-by: swathipil <[email protected]> Co-authored-by: Libba Lawrence <[email protected]> Co-authored-by: slister1001 <[email protected]> Co-authored-by: Matthew Metcalf <[email protected]> Co-authored-by: Ben Broderick Phillips <[email protected]> Co-authored-by: Chidozie Ononiwu <[email protected]> Co-authored-by: James Suplizio <[email protected]> Co-authored-by: MilesHolland <[email protected]> Co-authored-by: Diondra <[email protected]> Co-authored-by: Peter Wu <[email protected]> Co-authored-by: Nethra C Sashikar <[email protected]> Co-authored-by: Nethra Sashikar <[email protected]> Co-authored-by: msyyc <[email protected]> Co-authored-by: Scott Addie <[email protected]> Co-authored-by: David Wu <[email protected]> Co-authored-by: Krista Pratico <[email protected]> Co-authored-by: Mike Harder <[email protected]> Co-authored-by: Audunn Baldvinsson <[email protected]> Co-authored-by: Amit Chauhan <[email protected]> Co-authored-by: Avani Gupta <[email protected]>
1 parent ca909ce commit a870646

File tree

14 files changed

+840
-226
lines changed

14 files changed

+840
-226
lines changed

sdk/cosmos/azure-cosmos/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### 4.9.1 (Unreleased)
44

55
#### Features Added
6+
* Added change feed mode support in `query_items_change_feed`. See [PR 38105](https://github.com/Azure/azure-sdk-for-python/pull/38105)
67

78
#### Breaking Changes
89

sdk/cosmos/azure-cosmos/azure/cosmos/_base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
'supported_query_features': 'supportedQueryFeatures',
6262
'query_version': 'queryVersion',
6363
'priority': 'priorityLevel',
64-
'no_response': 'responsePayloadOnWriteDisabled'
64+
'no_response': 'responsePayloadOnWriteDisabled',
65+
'max_item_count': 'maxItemCount',
6566
}
6667

6768
# Cosmos resource ID validation regex breakdown:
@@ -170,6 +171,7 @@ def GetHeaders( # pylint: disable=too-many-statements,too-many-branches
170171
# set consistency level. check if set via options, this will override the default
171172
if options.get("consistencyLevel"):
172173
consistency_level = options["consistencyLevel"]
174+
# TODO: move this line outside of if-else cause to remove the code duplication
173175
headers[http_constants.HttpHeaders.ConsistencyLevel] = consistency_level
174176
elif default_client_consistency_level is not None:
175177
consistency_level = default_client_consistency_level

sdk/cosmos/azure-cosmos/azure/cosmos/_change_feed/change_feed_state.py

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
from abc import ABC, abstractmethod
3030
from enum import Enum
3131
from typing import Optional, Union, List, Any, Dict, Deque
32+
import logging
33+
from typing_extensions import Literal
3234

3335
from azure.cosmos import http_constants
3436
from azure.cosmos._change_feed.change_feed_start_from import ChangeFeedStartFromInternal, \
@@ -176,18 +178,18 @@ def apply_server_response_continuation(self, continuation: str, has_modified_res
176178

177179
class ChangeFeedStateV2(ChangeFeedState):
178180
container_rid_property_name = "containerRid"
179-
change_feed_mode_property_name = "mode"
181+
mode_property_name = "mode"
180182
change_feed_start_from_property_name = "startFrom"
181183
continuation_property_name = "continuation"
182184

183-
# TODO: adding change feed mode
184185
def __init__(
185186
self,
186187
container_link: str,
187188
container_rid: str,
188189
feed_range: FeedRangeInternal,
189190
change_feed_start_from: ChangeFeedStartFromInternal,
190-
continuation: Optional[FeedRangeCompositeContinuation]
191+
continuation: Optional[FeedRangeCompositeContinuation],
192+
mode: Optional[Literal["LatestVersion", "AllVersionsAndDeletes"]]
191193
) -> None:
192194

193195
self._container_link = container_link
@@ -208,6 +210,8 @@ def __init__(
208210
else:
209211
self._continuation = continuation
210212

213+
self._mode = "LatestVersion" if mode is None else mode
214+
211215
super(ChangeFeedStateV2, self).__init__(ChangeFeedStateVersion.V2)
212216

213217
@property
@@ -218,17 +222,14 @@ def to_dict(self) -> Dict[str, Any]:
218222
return {
219223
self.version_property_name: ChangeFeedStateVersion.V2.value,
220224
self.container_rid_property_name: self._container_rid,
221-
self.change_feed_mode_property_name: "LatestVersion",
225+
self.mode_property_name: self._mode,
222226
self.change_feed_start_from_property_name: self._change_feed_start_from.to_dict(),
223227
self.continuation_property_name: self._continuation.to_dict() if self._continuation is not None else None
224228
}
225229

226-
def populate_request_headers(
230+
def set_start_from_request_headers(
227231
self,
228-
routing_provider: SmartRoutingMapProvider,
229232
request_headers: Dict[str, Any]) -> None:
230-
request_headers[http_constants.HttpHeaders.AIM] = http_constants.HttpHeaders.IncrementalFeedHeaderValue
231-
232233
# When a merge happens, the child partition will contain documents ordered by LSN but the _ts/creation time
233234
# of the documents may not be sequential.
234235
# So when reading the changeFeed by LSN, it is possible to encounter documents with lower _ts.
@@ -243,11 +244,10 @@ def populate_request_headers(
243244
self._continuation.current_token.feed_range)
244245
change_feed_start_from_feed_range_and_etag.populate_request_headers(request_headers)
245246

246-
# based on the feed range to find the overlapping partition key range id
247-
over_lapping_ranges =\
248-
routing_provider.get_overlapping_ranges(
249-
self._container_link,
250-
[self._continuation.current_token.feed_range])
247+
def set_pk_range_id_request_headers(
248+
self,
249+
over_lapping_ranges,
250+
request_headers: Dict[str, Any]) -> None:
251251

252252
if len(over_lapping_ranges) > 1:
253253
raise self.get_feed_range_gone_error(over_lapping_ranges)
@@ -260,53 +260,51 @@ def populate_request_headers(
260260
# the current token feed range spans less than single physical partition
261261
# for this case, need to set both the partition key range id and epk filter headers
262262
request_headers[http_constants.HttpHeaders.PartitionKeyRangeID] = over_lapping_ranges[0]["id"]
263-
request_headers[
264-
http_constants.HttpHeaders.StartEpkString] = self._continuation.current_token.feed_range.min
265-
request_headers[
266-
http_constants.HttpHeaders.EndEpkString] = self._continuation.current_token.feed_range.max
263+
request_headers[http_constants.HttpHeaders.StartEpkString] = self._continuation.current_token.feed_range.min
264+
request_headers[http_constants.HttpHeaders.EndEpkString] = self._continuation.current_token.feed_range.max
267265

268-
async def populate_request_headers_async(
266+
def set_mode_request_headers(
269267
self,
270-
async_routing_provider: AsyncSmartRoutingMapProvider,
271268
request_headers: Dict[str, Any]) -> None:
272-
request_headers[http_constants.HttpHeaders.AIM] = http_constants.HttpHeaders.IncrementalFeedHeaderValue
269+
if self._mode == "AllVersionsAndDeletes":
270+
request_headers[http_constants.HttpHeaders.AIM] = http_constants.HttpHeaders.FullFidelityFeedHeaderValue
271+
request_headers[http_constants.HttpHeaders.ChangeFeedWireFormatVersion] = \
272+
http_constants.HttpHeaders.SeparateMetaWithCrts
273+
else:
274+
request_headers[http_constants.HttpHeaders.AIM] = http_constants.HttpHeaders.IncrementalFeedHeaderValue
273275

274-
# When a merge happens, the child partition will contain documents ordered by LSN but the _ts/creation time
275-
# of the documents may not be sequential.
276-
# So when reading the changeFeed by LSN, it is possible to encounter documents with lower _ts.
277-
# In order to guarantee we always get the documents after customer's point start time,
278-
# we will need to always pass the start time in the header.
279-
self._change_feed_start_from.populate_request_headers(request_headers)
276+
def populate_request_headers(
277+
self,
278+
routing_provider: SmartRoutingMapProvider,
279+
request_headers: Dict[str, Any]) -> None:
280+
self.set_start_from_request_headers(request_headers)
281+
282+
# based on the feed range to find the overlapping partition key range id
283+
over_lapping_ranges = \
284+
routing_provider.get_overlapping_ranges(
285+
self._container_link,
286+
[self._continuation.current_token.feed_range])
287+
288+
self.set_pk_range_id_request_headers(over_lapping_ranges, request_headers)
289+
290+
self.set_mode_request_headers(request_headers)
280291

281-
if self._continuation.current_token is not None and self._continuation.current_token.token is not None:
282-
change_feed_start_from_feed_range_and_etag = \
283-
ChangeFeedStartFromETagAndFeedRange(
284-
self._continuation.current_token.token,
285-
self._continuation.current_token.feed_range)
286-
change_feed_start_from_feed_range_and_etag.populate_request_headers(request_headers)
292+
293+
async def populate_request_headers_async(
294+
self,
295+
async_routing_provider: AsyncSmartRoutingMapProvider,
296+
request_headers: Dict[str, Any]) -> None:
297+
self.set_start_from_request_headers(request_headers)
287298

288299
# based on the feed range to find the overlapping partition key range id
289300
over_lapping_ranges = \
290301
await async_routing_provider.get_overlapping_ranges(
291302
self._container_link,
292303
[self._continuation.current_token.feed_range])
293304

294-
if len(over_lapping_ranges) > 1:
295-
raise self.get_feed_range_gone_error(over_lapping_ranges)
305+
self.set_pk_range_id_request_headers(over_lapping_ranges, request_headers)
296306

297-
overlapping_feed_range = Range.PartitionKeyRangeToRange(over_lapping_ranges[0])
298-
if overlapping_feed_range == self._continuation.current_token.feed_range:
299-
# exactly mapping to one physical partition, only need to set the partitionKeyRangeId
300-
request_headers[http_constants.HttpHeaders.PartitionKeyRangeID] = over_lapping_ranges[0]["id"]
301-
else:
302-
# the current token feed range spans less than single physical partition
303-
# for this case, need to set both the partition key range id and epk filter headers
304-
request_headers[http_constants.HttpHeaders.PartitionKeyRangeID] = \
305-
over_lapping_ranges[0]["id"]
306-
request_headers[http_constants.HttpHeaders.StartEpkString] = \
307-
self._continuation.current_token.feed_range.min
308-
request_headers[http_constants.HttpHeaders.EndEpkString] = \
309-
self._continuation.current_token.feed_range.max
307+
self.set_mode_request_headers(request_headers)
310308

311309
def populate_feed_options(self, feed_options: Dict[str, Any]) -> None:
312310
pass
@@ -367,12 +365,20 @@ def from_continuation(
367365
if continuation_data is None:
368366
raise ValueError(f"Invalid continuation: [Missing {ChangeFeedStateV2.continuation_property_name}]")
369367
continuation = FeedRangeCompositeContinuation.from_json(continuation_data)
370-
return ChangeFeedStateV2(
368+
369+
mode = continuation_json.get(ChangeFeedStateV2.mode_property_name)
370+
# All 'continuation_json' from ChangeFeedStateV2 must contain 'mode' property. For the 'continuation_json'
371+
# from older ChangeFeedState versions won't even hit this point, since their version is not 'v2'.
372+
if mode is None:
373+
raise ValueError(f"Invalid continuation: [Missing {ChangeFeedStateV2.mode_property_name}]")
374+
375+
return cls(
371376
container_link=container_link,
372377
container_rid=container_rid,
373378
feed_range=continuation.feed_range,
374379
change_feed_start_from=change_feed_start_from,
375-
continuation=continuation)
380+
continuation=continuation,
381+
mode=mode)
376382

377383
@classmethod
378384
def from_initial_state(
@@ -394,6 +400,7 @@ def from_initial_state(
394400
raise ValueError("partitionKey is in the changeFeedStateContext, but missing partitionKeyFeedRange")
395401
else:
396402
# default to full range
403+
logging.info("'feed_range' empty. Using full range by default.")
397404
feed_range = FeedRangeInternalEpk(
398405
Range(
399406
"",
@@ -405,11 +412,12 @@ def from_initial_state(
405412
change_feed_start_from = (
406413
ChangeFeedStartFromInternal.from_start_time(change_feed_state_context.get("startTime")))
407414

408-
if feed_range is not None:
409-
return cls(
410-
container_link=container_link,
411-
container_rid=collection_rid,
412-
feed_range=feed_range,
413-
change_feed_start_from=change_feed_start_from,
414-
continuation=None)
415-
raise ValueError("feed_range is empty")
415+
mode = change_feed_state_context.get("mode")
416+
417+
return cls(
418+
container_link=container_link,
419+
container_rid=collection_rid,
420+
feed_range=feed_range,
421+
change_feed_start_from=change_feed_start_from,
422+
continuation=None,
423+
mode=mode)
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# The MIT License (MIT)
2+
# Copyright (c) 2014 Microsoft Corporation
3+
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in all
12+
# copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
"""Internal Helper functions in the Azure Cosmos database change_feed service.
23+
"""
24+
25+
import warnings
26+
from datetime import datetime
27+
from typing import Any, Dict, Tuple
28+
29+
CHANGE_FEED_MODES = ["LatestVersion", "AllVersionsAndDeletes"]
30+
31+
def add_args_to_kwargs(
32+
args: Tuple[Any, ...],
33+
kwargs: Dict[str, Any]
34+
) -> None:
35+
"""Add positional arguments(args) to keyword argument dictionary(kwargs).
36+
Since 'query_items_change_feed' method only allows the following 4 positional arguments in the exact order
37+
and types, if the order and types don't match, errors will be raised.
38+
If the positional arguments are in the correct orders and types, the arguments will be added to keyword arguments.
39+
40+
4 positional arguments:
41+
- str 'partition_key_range_id': [Deprecated] ChangeFeed requests can be executed against specific partition
42+
key ranges. This is used to process the change feed in parallel across multiple consumers.
43+
- bool 'is_start_from_beginning': [Deprecated] Get whether change feed should start from
44+
beginning (true) or from current (false). By default, it's start from current (false).
45+
- str 'continuation': e_tag value to be used as continuation for reading change feed.
46+
- int 'max_item_count': Max number of items to be returned in the enumeration operation.
47+
48+
:param args: Positional arguments. Arguments must be in the following order:
49+
1. partition_key_range_id
50+
2. is_start_from_beginning
51+
3. continuation
52+
4. max_item_count
53+
:type args: Tuple[Any, ...]
54+
:param kwargs: Keyword arguments
55+
:type kwargs: dict[str, Any]
56+
"""
57+
if len(args) > 4:
58+
raise TypeError(f"'query_items_change_feed()' takes 4 positional arguments but {len(args)} were given.")
59+
60+
if len(args) > 0:
61+
keys = [
62+
'partition_key_range_id',
63+
'is_start_from_beginning',
64+
'continuation',
65+
'max_item_count',
66+
]
67+
for i, value in enumerate(args):
68+
key = keys[i]
69+
70+
if key in kwargs:
71+
raise TypeError(f"'query_items_change_feed()' got multiple values for argument '{key}'.")
72+
73+
kwargs[key] = value
74+
75+
def validate_kwargs(
76+
kwargs: Dict[str, Any]
77+
) -> None:
78+
"""Validate keyword arguments(kwargs).
79+
The values of keyword arguments must match the expect type and conditions. If the conditions do not match,
80+
errors will be raised with the error messages and possible ways to correct the errors.
81+
82+
:param kwargs: Keyword arguments to verify for query_items_change_feed API
83+
:keyword mode: Must be one of the values in the Enum, 'ChangeFeedMode'.
84+
If the value is 'ALL_VERSIONS_AND_DELETES', the following keywords must be in the right condition:
85+
- 'partition_key_range_id': Cannot be used at any time
86+
- 'is_start_from_beginning': Must be 'False'
87+
- 'start_time': Must be "Now"
88+
:paramtype mode: Optional[Literal["LatestVersion", "AllVersionsAndDeletes"]]
89+
:keyword partition_key_range_id: Deprecated Warning.
90+
:paramtype partition_key_range_id: str
91+
:keyword is_start_from_beginning: Deprecated Warning. Cannot be used with 'start_time'.
92+
:paramtype is_start_from_beginning: bool
93+
:keyword start_time: Must be in supported types.
94+
:paramtype start_time: Union[~datetime.datetime, Literal["Now", "Beginning"]]
95+
:type kwargs: dict[str, Any]
96+
"""
97+
# Filter items with value None
98+
kwargs = {key: value for key, value in kwargs.items() if value is not None}
99+
100+
# Validate the keyword arguments
101+
if "mode" in kwargs:
102+
mode = kwargs["mode"]
103+
if mode not in CHANGE_FEED_MODES:
104+
raise ValueError(
105+
f"Invalid mode was used: '{kwargs['mode']}'."
106+
f" Supported modes are {CHANGE_FEED_MODES}.")
107+
108+
if mode == 'AllVersionsAndDeletes':
109+
if "partition_key_range_id" in kwargs:
110+
raise ValueError(
111+
"'AllVersionsAndDeletes' mode is not supported if 'partition_key_range_id'"
112+
" was used. Please use 'feed_range' instead.")
113+
if "is_start_from_beginning" in kwargs and kwargs["is_start_from_beginning"] is not False:
114+
raise ValueError(
115+
"'AllVersionsAndDeletes' mode is only supported if 'is_start_from_beginning'"
116+
" is 'False'. Please use 'is_start_from_beginning=False' or 'continuation' instead.")
117+
if "start_time" in kwargs and kwargs["start_time"] != "Now":
118+
raise ValueError(
119+
"'AllVersionsAndDeletes' mode is only supported if 'start_time' is 'Now'."
120+
" Please use 'start_time=\"Now\"' or 'continuation' instead.")
121+
122+
if "partition_key_range_id" in kwargs:
123+
warnings.warn(
124+
"'partition_key_range_id' is deprecated. Please pass in 'feed_range' instead.",
125+
DeprecationWarning
126+
)
127+
128+
if "is_start_from_beginning" in kwargs:
129+
warnings.warn(
130+
"'is_start_from_beginning' is deprecated. Please pass in 'start_time' instead.",
131+
DeprecationWarning
132+
)
133+
134+
if not isinstance(kwargs["is_start_from_beginning"], bool):
135+
raise TypeError(
136+
f"'is_start_from_beginning' must be 'bool' type,"
137+
f" but given '{type(kwargs['is_start_from_beginning']).__name__}'.")
138+
139+
if kwargs["is_start_from_beginning"] is True and "start_time" in kwargs:
140+
raise ValueError("'is_start_from_beginning' and 'start_time' are exclusive, please only set one of them.")
141+
142+
if "start_time" in kwargs:
143+
if not isinstance(kwargs['start_time'], datetime):
144+
if kwargs['start_time'].lower() not in ["now", "beginning"]:
145+
raise ValueError(
146+
f"'start_time' must be either 'Now' or 'Beginning', but given '{kwargs['start_time']}'.")

0 commit comments

Comments
 (0)