- Fixed bug where
CosmosClientconstruction with AAD credentials would crash at startup if the semantic reranking inference endpoint environment variable was not set, even when semantic reranking was not being used. The inference service is now lazily initialized on first use. See PR 46243
- Reduced per-client memory overhead when partition-level circuit breaker (PPCB) is enabled by sharing the partition key range routing map cache across CosmosClient instances connected to the same endpoint, and stripping unused fields from cached partition key ranges using compact PKRange namedtuples. See PR 46297
- Fixed bug where container-focused requests using name-based addressing did not consistently populate the
x-ms-cosmos-intended-collection-ridheader. See PR 44080
- Updated partition key range routing map refresh to use change-feed-based refresh flow instead of feed-range reads, improving internal refresh behavior for split/stale routing scenarios. See PR 44080
- Added support for Query Advisor feature - See PR 45331
- Added
get_response_headers()andget_last_response_headers()methods to theCosmosItemPagedandCosmosAsyncItemPagedobjects returned byquery_items(), allowing access to response headers from query operations. See PR 44593 - Added InferenceRequestTimeout property for HttpTimeout Policy to Reranking API. See 45469
- Added
full_text_score_scopeparameter toquery_items()for controlling BM25 statistics scope in hybrid search queries. Supports "Local" and "Global" (default) scopes. See 45686
- Fixed bug where a compound session token (containing multiple partition tokens) was sent for single-partition feed range queries. See PR 44484
- Fixed regression where
user_agent_overwritekwarg was not cleaned up properly, causingTypeErrorcrash on sync client construction. See PR 45653 - Fixed bug where client-level
read_timeoutconfiguration was not being automatically applied to all queries. See PR 44472
- Enhanced error logging by attaching endpoint information to exceptions during database account retrieval. See PR 44484
Important
We strongly recommend that customers use at least version 4.15.0 of azure-cosmos.
- GA support of Per Partition Automatic Failover and AvailabilityStrategy features.
- Fixed bug where sdk was encountering a timeout issue caused by infinite recursion during the 410 (Gone) error. See PR 44770
- Fixed crash in sync and async clients when
force_refresh_on_startupwas set toNone, which could surface asAttributeError: 'NoneType' object has no attribute '_WritableLocations'during region discovery whendatabase_accountwasNone. See PR 44987 - Fixed bug where unavailable regional endpoints were dropped from the routing list instead of being kept as fallback options. See PR 45200
- Added tests for multi-language support for full text search. See PR 44254
- Renamed
availability_strategy_configintroduced in 4.15.0b1 toavailability_strategyfor both sync and async clients. See PR 45086. - Request-level
availability_strategyneeds to be set toFalsein order to disable availability strategy for that request, as opposed to setting it toNone. See PR 45141.
- Fixed async client crash (
AttributeError: 'NoneType' object has no attribute '_WritableLocations') during region discovery whendatabase_accountwasNone. See PR 44939
- Fixed bug where sdk was encountering a timeout issue caused by infinite recursion during the 410 (Gone) error.See PR 44659
- Fixed bug where sdk was not properly retrying requests in some edge cases after partition splits.See PR 44425
- Fixed bug where sdk was not properly retrying requests in some edge cases after partition splits.See PR 44425
- Fixed bug where client timeout/read_timeout values were not properly enforced. See PR 42652.
- Fixed bug when passing in None for some options in
query_itemswould cause unexpected errors. See PR 44098
- Added support for Per Partition Automatic Failover. To enable this feature, you must follow the guide here. See PR 41588.
- Added support for AvailabilityStrategy to help improve request latency and availability in multi-region deployments. See PR 42584
- Fixed bug where client timeout/read_timeout values were not properly enforced. See PR 42652.
- Fixed bug when passing in None for some options in
query_itemswould cause unexpected errors. See PR 44098 - Fixed bug where first metadata requests have duplicated custom
user_agentin headers. See PR 44189
- Added cross-regional retries for 503 (Service Unavailable) errors. See PR 41588.
- Added merge support. See PR 42924.
- Added support for priority-based throttling at the client level for sync and async clients. See PR 43917
- Fixed bug where customer provided excluded region was not always being honored during certain transient failures. See PR 43602
- Fixed TypeError bug when
parameters=Noneinquery_items. See PR 43681
- Further optimized health checks for sync and async clients. See PR 43339
- Enhanced logging to ensure when a region is marked unavailable we have the proper context. See PR 43602
- Fixed bug where queries using
feed_rangeandcontinuationoptions would not work as expected. See PR 43700.
This version and all future versions will require Python 3.9+.
- Added ability to return a tuple of a DatabaseProxy/ContainerProxy with the associated database/container properties when creating or reading databases/containers through
return_propertiesparameter. See PR 41742 - Added a new preview feature API for Semantic Reranking. See PR 42991
- Changed
retry_writefrombooltointto match other retryable options. See PR 43341.
- Fixed bug where exclusion list was not honored before falling back to global endpoint for multi-write region accounts. SeePR 43297
- Removed dual endpoint tracking from the sdk. See PR 40451.
- Reverted typehints to fix the mismatch issue. See PR 43124
- Corrected type hints for
ConsistencyPolicyinDatabaseAccountclass. See PR 43150
- Fixed bug where client provided session token was not respected when client-side session management was disabled. See PR 42965
- Added read_items API to provide an efficient method for retrieving multiple items in a single request. See PR 42167.
- Added ability to replace a container's indexing policy if a vector embedding policy was present. See PR 42810.
- Improved the resilience of Database Account Read metadata operation against short-lived network issues by increasing number of retries. See PR 42525.
- Fixed bug where during health checks read regions were marked as unavailable for write operations. See PR 42525.
- Fixed bug where containers named with spaces or special characters using session consistency would fall back to eventual consistency. See PR 42608
- Fixed bug where
excluded_locationswas not being honored for some metadata calls. See PR 42266. - Fixed bug where Hybrid Search queries using parameters were not working. See PR 42787
- Fixed partition scoping for per partition circuit breaker. See PR 42751
- Fixed bug where
partition_keyset to None was not properly handled for some operations. See PR 42747
- Added session token false progress merge logic. See 42393
- Added a fallback mechanism to AAD scope override. See PR 42731.
- Added feed range support in
query_items. See PR 41722.
- Fixed session container session token logic. The SDK will now only send the relevant partition-local session tokens for read document requests and write requests when multi-region writes are enabled, as opposed to the entire compound session token for the container for every document request. See PR 41678.
- Write requests for single-write region accounts will no longer send session tokens when using session consistency. See PR 41678.
- Fixed bug where container cache was not being properly updated resulting in unnecessary extra requests. See PR 42143.
- Fixed bug where the Filters on Parent loggers or handlers of Cosmos Diagnostics loggers were not being applied. See PR 41012
- Changed to include client id in headers for all requests. See PR 42104.
- Added an option to override AAD audience scope through environment variable. See PR 42228.
- Diagnostics logging will now log ServiceRequestError Exceptions, ServiceResponseError Exceptions, and Cosmos exceptions with a status code of 500 or greater. See PR 41012
- Added option to enable automatic retries for write document operations. See PR 41272.
- Adds cross region retries when no preferred locations are set. This is only a breaking change for customers using bounded staleness consistency. See PR 39714
- Fixed bug where replacing manual throughput using
ThroughputPropertieswould not work. See PR 41564 - Fixed bug where constantly raising Service Request Error Exceptions would cause the Service Request Retry Policy to indefinitely retry the request during a query or when a request was sent without a request object. See PR 41804
- Fixed issue where key error would occur when getting properties from a container using legacy hash v1 as they may not always contain version property in the partition key definition. See PR 41639
- Added ability to set a user agent suffix at the client level. See PR 40904
- Added ability to use request level
excluded_locationson metadata calls, such as getting container properties. See PR 40905 - Per partition circuit breaker support. It can be enabled through the environment variable
AZURE_COSMOS_ENABLE_CIRCUIT_BREAKER. See PR 40302.
- Fixed how resource tokens are parsed for metadata calls in the lifecycle of a document operation. See PR 40302.
- Fixed issue where Query Change Feed did not return items if the container uses legacy Hash V1 Partition Keys. This also fixes issues with not being able to change feed query for Specific Partition Key Values for HPK. See PR 41270
- Added Client Generated Activity IDs to all Requests. Cosmos Diagnostics Logs will more clearly show the Activity ID for each request and response. PR 41013
- Added ability to use weighted RRF (Reciprocal Rank Fusion) for Hybrid full text search queries. See PR 40899.
- Fixed Diagnostics Error Log Formatting to handle error messages from non-CosmosHttpResponseExceptions. See PR 40889
- Fixed bug where
multiple_write_locationsoption in client was not being honored. See PR 40999.
- Added ability to set
throughput_bucketheader at the client level and for all requests. See PR 40340. - Added ability to use Filters from Logging module on Diagnostics Logging based on Http request/response related attributes. See PR 39897.
- Added ability to use
excluded_locationson client level and document API request level. See PR 40298
- Fixed bug where change feed requests would not respect the partition key filter. See PR 40677.
- Fixed how the environment variables in the sdk are parsed. See PR 40303.
- Fixed health check to check the first write region when it is not specified in the preferred regions. See PR 40588.
- Fixed
response_hooknot getting called for aggregate queries. See PR 40696. - Fixed bug where writes were being retried for 5xx status codes for patch and replace. See PR 40672.
- Optimized Diagnostics Logging by reducing time spent on logging. Logged Errors are more readable and formatted. See PR 39897.
- Health checks are now done concurrently and for all regions for async apis. See PR 40588.
- Fixed bug introduced in 4.10.0b3 with explicitly setting
etagkeyword argument asNonecausing exceptions. See PR 40282.
- Fixed too many health checks happening when skipping the recommended client startup. See PR 40203.
- Removed excess keyword arguments from methods that did not use them. See PR 40008.
- Removed first
response_hookcall for query methods that would utilize wrong response headers. See PR 40008.
- Fixed bug preventing health check in some scenarios. See PR 39647.
- Fixed
partition_keyfilter forquery_items_change_feedAPI. See PR 39895.
- Moved endpoint health check to the background for async APIs. See PR 39647.
- Added ability to replace
computed_propertiesthroughreplace_containermethod. See PR 39543.
- Un-marked
computed_propertieskeyword as provisional. See PR 39543.
- Improved retry logic for read requests to failover on other regions in case of timeouts and any error codes >= 500. See PR 39596.
- Fixed a regression where read operations were not retrying on timeouts. See PR 39596
- Updated default read timeout for
getDatabaseAccountcalls to 3 seconds. See PR 39596
- Improved retry logic by retrying alternative endpoint for writes within a region before performing a cross region retry. See PR 39390.
- Added endpoint health check logic during database account calls. See PR 39390
- Fixed unnecessary retries on the wrong region for timout retry policy. See PR 39390.
- All client connection errors from aiohttp will be retried. See PR 39390.
- Changed defaults for retry delays. See PR 39390.
- Changed default connection timeout to be 5 seconds. See PR 39390.
- Changed default read timeout to be 65 seconds. See PR 39390.
- On database account calls send a client id header for load balancing. See PR 39390.
- Removed aiohttp dependency. See PR 39390.
- Added new cross-regional retry logic for
ServiceRequestErrorandServiceResponseErrorexceptions. See PR 39396.
- Fixed
KeyErrorbeing returned by location cache when most preferred location is not present in cached regions. See PR 39396. - Fixed cross-region retries on
CosmosClientinitialization. See PR 39396.
- This release requires aiohttp version 3.10.11 and above. See PR 39396.
- Added change feed mode support in
query_items_change_feed. See PR 38105. - Added a Preview Feature for adding Diagnostics Handler to filter what diagnostics get logged. This feature is subject to change significantly. See PR 38105.
- Added full text policy and full text indexing policy. See PR 37891.
- Added support for full text search and hybrid search queries. See PR 38275.
This version and all future versions will support Python 3.13.
- Added response headers directly to SDK item point operation responses. See PR 35791.
- SDK will now retry all ServiceRequestErrors (failing outgoing requests) before failing. Default number of retries is 3. See PR 36514.
- Added Retry Policy for Container Recreate in the Python SDK. See PR 36043.
- Added option to disable write payload on writes. See PR 37365.
- Added get feed ranges API. See PR 37687.
- Added feed range support in
query_items_change_feed. See PR 37687. - Added provisional helper APIs for managing session tokens. See PR 36971.
- Added ability to get feed range for a partition key. See PR 36971.
- Item-level point operations will now return
CosmosDictandCosmosListresponse types. Responses will still be able to be used directly as previously, but will now have access to their response headers without need for a response hook. See PR 35791. For more information on this, see our README section here.
- Consolidated Container Properties Cache to be in the Client to cache partition key definition and container rid to avoid unnecessary container reads. See PR 35731.
- Fixed bug with client hangs when running into WriteForbidden exceptions. See PR 36514.
- Added retry handling logic for DatabaseAccountNotFound exceptions. See PR 36514.
- Fixed SDK regex validation that would not allow for item ids to be longer than 255 characters. See PR 36569.
- Fixed issue where 'NoneType' object has no attribute error was raised when a session retry happened during a query. See PR 37578.
- Fixed issue where passing subpartition partition key values as a tuple in a query would raise an error. See PR 38136.
- Batch requests will now be properly considered as Write operation. See PR 38365.
- Getting offer thoughput when it has not been defined in a container will now give a 404/10004 instead of just a 404. See PR 36043.
- Incomplete Partition Key Extractions in documents for Subpartitioning now gives 400/1001 instead of just a 400. See PR 36043.
- SDK will now make database account calls every 5 minutes to refresh location cache. See PR 36514.
- Adds vector embedding policy and vector indexing policy. See PR 34882.
- Adds support for vector search non-streaming order by queries. See PR 35468.
- Adds support for using the start time option for change feed query API. See PR 35090.
- Fixed a bug where change feed query in Async client was not returning all pages due to case-sensitive response headers. See PR 35090.
- Fixed a bug when a retryable exception occurs in the first page of a query execution causing query to return 0 results. See PR 35090.
- GA release of hierarchical partitioning, index metrics and transactional batch.
- Keyword arguments were not being passed down for
create_container_if_not_exists()methods. See PR 34286.
- Made several updates to the type hints used throughout the SDK for greater detail. See PR 33269, PR 33341, PR 33738.
- Fixed bug with async lock not properly releasing on async global endpoint manager. see PR 34579.
- Marked
computed_propertieskeyword as provisional, un-markedcontinuation_token_limitas provisional. See PR 34207.
This version and all future versions will require Python 3.8+.
- Added preview support for Computed Properties on Python SDK (Must be enabled on the account level before it can be used). See PR 33626.
- Made use of
response_hookthread-safe in the sync client. See PR 33790. - Fixed bug with the session container not being properly maintained. See 33738.
- Added support for capturing Index Metrics in query operations. See PR 33034.
- Added support for Transactional Batch. See PR 32508.
- Added preview support for Priority Based Throttling/Priority Based Execution (Must be enabled at the account level before it can be used). See PR 32441.
- Added support for Hierarchical Partitioning, also known as Subpartitioning. See PR 31121.
- Small fix to the
offer_throughputoption in the async client'screate_database_if_not_existsmethod, which was previously misspelled asofferThroughput. See PR 32076.
- Marked the outdated
diagnostics.pyfile for deprecation since we now recommend the use of ourCosmosHttpLoggingPolicyfor diagnostics. For more on theCosmosHttpLoggingPolicysee our README.
- Fixed bug when query with DISTINCT + OFFSET/LIMIT operators returns unexpected result. See PR 31925.
- Added additional checks for resource creation using specific characters that cause issues. See PR 31861.
- Added support for continuation tokens for streamable cross partition queries. See PR 31189.
- Fixed bug with async
create_database_if_not_existsmethod not working when passingoffer_throughputas an option. See PR 31478.
- Renamed
response_continuation_token_limit_in_kbtocontinuation_token_limitfor GA. See PR 31532.
- Added ability to limit continuation token size when querying for items. See PR 30731
- Fixed bug with async patch_item method. See PR 30804.
- GA release of Patch API and Delete All Items By Partition Key
- Added conditional patching for Patch operations. See PR 30455.
- Fixed bug with non english locales causing an error with the RFC 1123 Date Format. See PR 30125.
- Refactoring of our client
connection_timeoutandrequest_timeoutconfigurations. See PR 30171.
- Added preview delete all items by partition key functionality. See PR 29186. For more information on Partition Key Delete, please see Azure Cosmos DB Partition Key Delete.
- Added preview partial document update (Patch API) functionality and container methods for patching items with operations. See PR 29497. For more information on Patch, please see Azure Cosmos DB Partial Document Update.
- Fixed bug in method
create_container_if_not_exists()of async database client for unexpected kwargs being passed intoread()method used internally. See PR 29136. - Fixed bug with method
query_items()of our async container class, where partition key and cross partition headers would both be set when using partition keys. See PR 29366. - Fixed bug with client not properly surfacing errors for invalid credentials and identities with insufficient permissions. Users running into 'NoneType has no attribute ConsistencyPolicy' errors when initializing their clients will now see proper authentication exceptions. See PR 29256.
- Removed use of
sixpackage within the SDK.
- Added
correlated_activity_idfor query operations. - Added cross regional retries for Service Unavailable/Request Timeouts for read/Query Plan operations.
- GA release of CosmosHttpLoggingPolicy and autoscale feature.
- Bug fix to address queries with VALUE MAX (or any other aggregate) that run into an issue if the query is executed on a container with at least one "empty" partition.
- GA release of integrated cache functionality. For more information on integrated cache please see Azure Cosmos DB integrated cache.
- Added ability to replace analytical ttl on containers. For more information on analytical ttl please see Azure Cosmos DB analytical store.
- Added
CosmosHttpLoggingPolicyto replaceHttpLoggingPolicyfor logging HTTP sessions. - Added the ability to create containers and databases with autoscale properties for the sync and async clients.
- Added the ability to update autoscale throughput properties.
- Fixed parsing of args for overloaded
container.read()method. - Fixed
validate_cache_staleness_value()method to allow max_integrated_cache_staleness to be an integer greater than or equal to 0. - Fixed
__aiter__()method by removing the async keyword.
- GA release of Async I/O APIs, including all changes from 4.3.0b1 to 4.3.0b4.
- Method signatures have been updated to use keyword arguments instead of positional arguments for most method options in the async client.
- Bugfix: Automatic Id generation for items was turned on for
upsert_items()method when no 'id' value was present in document body. Method call will now require an 'id' field to be present in the document body.
- Deprecated offer-named methods in favor of their new throughput-named counterparts (
read_offer->get_throughput). - Marked the GetAuthorizationHeader method for deprecation since it will no longer be public in a future release.
- Added samples showing how to configure retry options for both the sync and async clients.
- Deprecated the
connection_retry_policyandretry_optionsoptions in the sync client. - Added user warning to non-query methods trying to use
populate_query_metricsoptions.
- Added support for AAD authentication for the async client.
- Added support for AAD authentication for the sync client.
- Changed
_set_partition_keyreturn typehint in async client.
[WARNING] The default
Sessionconsistency bugfix will impact customers whose database accounts have aBounded StalenessorStrongconsistency level, and were previously not sendingSessionas a consistency_level parameter when initializing their clients. Default consistency level for the sync and async clients is no longer "Session" and will instead be set to the consistency level of the user's cosmos account setting on initialization if not passed during client initialization. Please see Consistency Levels in Azure Cosmos DB for more details on consistency levels, or the README section on this change here.
- Added new provisional
max_integrated_cache_staleness_in_msparameter to read item and query items APIs in order to make use of the preview CosmosDB integrated cache functionality See PR #22946. Please see Azure Cosmos DB integrated cache for more details. - Added support for split-proof queries for the async client.
- Default consistency level for the sync and async clients is no longer
Sessionand will instead be set to the consistency level of the user's cosmos account setting on initialization if not passed during client initialization. This change will impact client application in terms of RUs and latency. Users relying on defaultSessionconsistency will need to pass it explicitly if their account consistency is different thanSession. Please see Consistency Levels in Azure Cosmos DB for more details. - Fixed invalid request body being sent when passing in
serverScriptbody parameter to replace operations for trigger, sproc and udf resources. - Moved
is_system_keylogic in async client. - Fixed TypeErrors not being thrown when passing in invalid connection retry policies to the client.
This version and all future versions will require Python 3.6+. Python 2.7 is no longer supported. We will also be removing support for Python 3.6 and will only support Python 3.7+ starting December 2022.
- Added support for split-proof queries for the sync client.
- Added async user agent for async client.
- Added language native async i/o client.
Bug fixes
- Fixed bug where continuation token is not honored when query_iterable is used to get results by page. Issue #13265.
- Fixed bug where resource tokens not being honored for document reads and deletes. Issue #13634.
New features
- Added support for passing partitionKey while querying changefeed. Issue #11689.
- Added deprecation warning for "lazy" indexing mode. The backend no longer allows creating containers with this mode and will set them to consistent instead.
New features
- Added the ability to set the analytical storage TTL when creating a new container.
Bug fixes
- Fixed support for dicts as inputs for get_client APIs.
- Fixed Python 2/3 compatibility in query iterators.
- Fixed type hint error. Issue #12570 - thanks @sl-sandy.
- Fixed bug where options headers were not added to upsert_item function. Issue #11791 - thank you @aalapatirvbd.
- Fixed error raised when a non string ID is used in an item. It now raises TypeError rather than AttributeError. Issue #11793 - thank you @Rabbit994.
- Stable release.
- Added HttpLoggingPolicy to pipeline to enable passing in a custom logger for request and response headers.
- Fixed bug in synchronized_request for media APIs.
- Removed MediaReadMode and MediaRequestTimeout from ConnectionPolicy as media requests are not supported.
- azure.cosmos.errors module deprecated and replaced by azure.cosmos.exceptions
- The access condition parameters (
access_condition,if_match,if_none_match) have been deprecated in favor of separatematch_conditionandetagparameters. - Fixed bug in routing map provider.
- Added query Distinct, Offset and Limit support.
- Default document query execution context now used for
- ChangeFeed queries
- single partition queries (partitionkey, partitionKeyRangeId is present in options)
- Non document queries
- Errors out for aggregates on multiple partitions, with enable cross partition query set to true, but no "value" keyword present
- Hits query plan endpoint for other scenarios to fetch query plan
- Added
__repr__support for Cosmos entity objects. - Updated documentation.
- Added support for a
timeoutkeyword argument to all operations to specify an absolute timeout in seconds within which the operation must be completed. If the timeout value is exceeded, aazure.cosmos.errors.CosmosClientTimeoutErrorwill be raised. - Added a new
ConnectionRetryPolicyto manage retry behaviour during HTTP connection errors. - Added new constructor and per-operation configuration keyword arguments:
retry_total- Maximum retry attempts.retry_backoff_max- Maximum retry wait time in seconds.retry_fixed_interval- Fixed retry interval in milliseconds.retry_read- Maximum number of socket read retry attempts.retry_connect- Maximum number of connection error retry attempts.retry_status- Maximum number of retry attempts on error status codes.retry_on_status_codes- A list of specific status codes to retry on.retry_backoff_factor- Factor to calculate wait time between retry attempts.
- Added
create_database_if_not_exists()andcreate_container_if_not_existsfunctionalities to CosmosClient and Database respectively.
Version 4.0.0b2 is the second iteration in our efforts to build a more Pythonic client library.
Breaking changes
- The client connection has been adapted to consume the HTTP pipeline defined in
azure.core.pipeline. - Interactive objects have now been renamed as proxies. This includes:
Database->DatabaseProxyUser->UserProxyContainer->ContainerProxyScripts->ScriptsProxy
- The constructor of
CosmosClienthas been updated:- The
authparameter has been renamed tocredentialand will now take an authentication type directly. This means the master key value, a dictionary of resource tokens, or a list of permissions can be passed in. However the old dictionary format is still supported. - The
connection_policyparameter has been made a keyword only parameter, and while it is still supported, each of the individual attributes of the policy can now be passed in as explicit keyword arguments:request_timeoutmedia_request_timeoutconnection_modemedia_read_modeproxy_configenable_endpoint_discoverypreferred_locationsmultiple_write_locations
- The
- A new classmethod constructor has been added to
CosmosClientto enable creation via a connection string retrieved from the Azure portal. - Some
read_alloperations have been renamed tolistoperations:CosmosClient.read_all_databases->CosmosClient.list_databasesContainer.read_all_conflicts->ContainerProxy.list_conflictsDatabase.read_all_containers->DatabaseProxy.list_containersDatabase.read_all_users->DatabaseProxy.list_usersUser.read_all_permissions->UserProxy.list_permissions
- All operations that take
request_optionsorfeed_optionsparameters, these have been moved to keyword only parameters. In addition, while these options dictionaries are still supported, each of the individual options within the dictionary are now supported as explicit keyword arguments. - The error hierarchy is now inherited from
azure.core.AzureErrorinstead ofCosmosErrorwhich has been removed.HTTPFailurehas been renamed toCosmosHttpResponseErrorJSONParseFailurehas been removed and replaced byazure.core.DecodeError- Added additional errors for specific response codes:
CosmosResourceNotFoundErrorfor status 404CosmosResourceExistsErrorfor status 409CosmosAccessConditionFailedErrorfor status 412
CosmosClientcan now be run in a context manager to handle closing the client connection.- Iterable responses (e.g. query responses and list responses) are now of type
azure.core.paging.ItemPaged. The methodfetch_next_blockhas been replaced by a secondary iterator, accessed by theby_pagemethod.
Version 4.0.0b1 is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Cosmos. For more information about this, and preview releases of other Azure SDK libraries, please visit https://aka.ms/azure-sdk-preview1-python.
Breaking changes: New API design
-
Operations are now scoped to a particular client:
CosmosClient: This client handles account-level operations. This includes managing service properties and listing the databases within an account.Database: This client handles database-level operations. This includes creating and deleting containers, users and stored procedures. It can be accessed from aCosmosClientinstance by name.Container: This client handles operations for a particular container. This includes querying and inserting items and managing properties.User: This client handles operations for a particular user. This includes adding and deleting permissions and managing user properties.
These clients can be accessed by navigating down the client hierarchy using the
get_<child>_clientmethod. For full details on the new API, please see the reference documentation. -
Clients are accessed by name rather than by Id. No need to concatenate strings to create links.
-
No more need to import types and methods from individual modules. The public API surface area is available directly in the
azure.cosmospackage. -
Individual request properties can be provided as keyword arguments rather than constructing a separate
RequestOptionsinstance.
- Added Support for MultiPolygon Datatype
- Bug Fix in Session Read Retry Policy
- Bug Fix for Incorrect padding issues while decoding base 64 strings
- Bug fix in LocationCache
- Bug fix endpoint retry logic
- Fixed documentation
- Multi-region write support added
- Naming changes
- DocumentClient to CosmosClient
- Collection to Container
- Document to Item
- Package name updated to "azure-cosmos"
- Namespace updated to "azure.cosmos"
- Added support for proxy
- Added support for reading change feed
- Added support for collection quota headers
- Bugfix for large session tokens issue
- Bugfix for ReadMedia API
- Bugfix in partition key range cache
- Added support for default retries on connection issues.
- Updated documentation to reference Azure Cosmos DB instead of Azure DocumentDB.
- This SDK version requires the latest version of Azure Cosmos DB Emulator available for download from https://aka.ms/cosmosdb-emulator.
- bugfix for aggregate dict
- bugfix for trimming slashes in the resource link
- tests for unicode encoding
- Added support for Request Unit per Minute (RU/m) feature.
- Added support for a new consistency level called ConsistentPrefix.
- Added support for aggregation queries (COUNT, MIN, MAX, SUM, and AVG).
- Added an option for disabling SSL verification when running against DocumentDB Emulator.
- Removed the restriction of dependent requests module to be exactly 2.10.0.
- Lowered minimum throughput on partitioned collections from 10,100 RU/s to 2500 RU/s.
- Added support for enabling script logging during stored procedure execution.
- REST API version bumped to '2017-01-19' with this release.
- Made editorial changes to documentation comments.
- Added support for Python 3.5.
- Added support for connection pooling using the requests module.
- Added support for session consistency.
- Added support for TOP/ORDERBY queries for partitioned collections.
-
Added retry policy support for throttled requests. (Throttled requests receive a request rate too large exception, error code 429.) By default, DocumentDB retries nine times for each request when error code 429 is encountered, honoring the retryAfter time in the response header. A fixed retry interval time can now be set as part of the RetryOptions property on the ConnectionPolicy object if you want to ignore the retryAfter time returned by server between the retries. DocumentDB now waits for a maximum of 30 seconds for each request that is being throttled (irrespective of retry count) and returns the response with error code 429. This time can also be overridden in the RetryOptions property on ConnectionPolicy object.
-
DocumentDB now returns x-ms-throttle-retry-count and x-ms-throttle-retry-wait-time-ms as the response headers in every request to denote the throttle retry count and the cumulative time the request waited between the retries.
-
Removed the RetryPolicy class and the corresponding property (retry_policy) exposed on the document_client class and instead introduced a RetryOptions class exposing the RetryOptions property on ConnectionPolicy class that can be used to override some of the default retry options.
- Added the support for geo-replicated database accounts.
- Test fixes to move the global host and masterKey into the individual test classes.
- Added the support for Time To Live(TTL) feature for documents.
- Bug fixes related to server side partitioning to allow special characters in partitionkey path.
- Added the support for server side partitioned collections feature.
- Added Client-side sharding framework to the SDK. Implemented HashPartionResolver and RangePartitionResolver classes.
- Implement Upsert. New UpsertXXX methods added to support Upsert feature.
- Implement ID Based Routing. No public API changes, all changes internal.
- Release skipped to bring version number in alignment with other SDKs
- Supports GeoSpatial index.
- Validates id property for all resources. Ids for resources cannot contain ?, /, #, \, characters or end with a space.
- Adds new header "index transformation progress" to ResourceResponse.
- Implements V2 indexing policy
- Supports proxy connection