DM-4708: add CosmosDbConnectionConfig for Azure Cosmos DB - #46
Draft
AaronBarnes07 wants to merge 2 commits into
Draft
DM-4708: add CosmosDbConnectionConfig for Azure Cosmos DB#46AaronBarnes07 wants to merge 2 commits into
AaronBarnes07 wants to merge 2 commits into
Conversation
Cosmos DB's MongoDB API is wire-compatible, so the config reuses MongoConnectionConfig and differs only by db_type and two defaults: TLS on, because Cosmos only accepts TLS, and retryable writes off, because Cosmos rejects them. Needed by the AIT framework, which builds its DataMasque connection payloads through this client.
The Mongo serializer pruned `tls` when falsy and `retry_writes` when truthy, which encodes MongoDB's server-side defaults. Cosmos DB inverts both, so a caller asking for `tls=False` or `retry_writes=True` had the key dropped and the server applied the opposite. Pruning now compares against the concrete class's default, which is the default the server applies for that connection type. `DatabaseConnectionConfig` also now steers documentdb and cosmosdb at their own classes, as it already did for the other special engines, and the release requires 3.26.17 rather than 3.26.18.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DM-4708: add
CosmosDbConnectionConfigfor Azure Cosmos DB for MongoDB.Cosmos DB's MongoDB API is wire-compatible, so the config reuses
MongoConnectionConfigand differs only bydb_type/database_typeand two defaults:tlson, because Cosmos DB accepts nothing else, andretry_writesoff, because Cosmos DB rejects retryable writes.Needed by the DataMasque AIT suite, which creates Cosmos connections through this client (datamasque-automation!1232), and pairs with the server-side connection type (datamasque!3711).
Issues found along the way
The inherited serializer dropped the values it was asked to send.
MongoConnectionConfig._serializeprunestlswhen falsy andretry_writeswhen truthy, which encodes MongoDB's server-side defaults. Cosmos DB inverts both, soCosmosDbConnectionConfig(..., tls=False)or(..., retry_writes=True)had the key dropped and the server applied the opposite of what was asked, silently. Pruning now compares against the concrete class's default, which is the default the server applies for that connection type.DatabaseConnectionConfigdid not steer users at the new class. It raises a "use X instead" error fordynamodb,snowflake,mongodbanddatabricks, but not forcosmosdb— nor for the pre-existingdocumentdb. Both are added.HISTORY.rstnamed the wrong server version. The connection type ships in 3.26.17, not 3.26.18.Before this is released
The AIT suite currently pins
1.3.0.dev1from TestPyPI, and the db2i runner installs its pin from public PyPI, so 1.3.0 needs a real release before datamasque-automation!1232 can merge.Testing
520 tests passing;
ruff check,ruff format --checkandmypyclean.