Skip to content

PYTHON-5909 Add GA support for Queryable Encryption string queries - #2981

Draft
aclark4life wants to merge 1 commit into
mongodb:mainfrom
aclark4life:PYTHON-5909
Draft

PYTHON-5909 Add GA support for Queryable Encryption string queries#2981
aclark4life wants to merge 1 commit into
mongodb:mainfrom
aclark4life:PYTHON-5909

Conversation

@aclark4life

Copy link
Copy Markdown
Contributor

PYTHON-5909

Adds general availability support for Queryable Encryption prefix, suffix, and substring queries against MongoDB 9.0+ (requires libmongocrypt 1.20.0+).

  • Algorithm.STRING and StringOpts replace Algorithm.TEXTPREVIEW and TextOpts, which are now deprecated.
  • New QueryType.PREFIX, QueryType.SUFFIX, and QueryType.SUBSTRING. The *PREVIEW query types remain for experimental use with pre-9.0 servers.
  • ClientEncryption.encrypt() / AsyncClientEncryption.encrypt() gain a string_opts parameter; text_opts is kept as a deprecated alias and raises ConfigurationError if both are passed.
  • Prose tests updated to the spec's "String Explicit Encryption" tests, plus unit tests for the deprecation shims.
  • Changelog entry added.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GA support for Queryable Encryption string queries (prefix/suffix/substring) targeting MongoDB 9.0+, including API updates and refreshed prose/integration coverage, and introduces CI/process changes to better manage uv.lock maintenance.

Changes:

  • Introduces Algorithm.STRING, StringOpts, and GA QueryType values (PREFIX, SUFFIX, SUBSTRING) while deprecating TextOpts/Algorithm.TEXTPREVIEW and keeping preview query types for pre-9.0 servers.
  • Updates encryption prose/integration tests (sync + async) to cover GA vs preview behavior, plus adds unit tests for the deprecation shims.
  • Adds/adjusts dependency-management workflows and docs around uv.lock (scheduled lockfile update workflow, uv lock --check in CI, Dependabot tuning).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/test_encryption.py Sync encryption tests updated for string GA/preview query behavior + deprecation shim tests.
test/asynchronous/test_encryption.py Async encryption tests updated for string GA/preview query behavior + deprecation shim tests.
pymongo/encryption_options.py Adds StringOpts; deprecates TextOpts as a compatibility shim.
pymongo/synchronous/encryption.py Sync encryption API updated to accept string_opts and deprecate text_opts; adds GA string/query enums.
pymongo/asynchronous/encryption.py Async encryption API updated to accept string_opts and deprecate text_opts; adds GA string/query enums.
doc/changelog.rst Documents GA support and the new/Deprecated APIs.
pyproject.toml Adjusts uv dependency constraints to avoid problematic back-solving for boto3 across forks.
CONTRIBUTING.md Updates dependency/lockfile workflow guidance for contributors.
.pre-commit-config.yaml Excludes uv.lock from the large-file pre-commit check.
.gitignore Stops ignoring uv.lock so it can be committed/checked.
.github/workflows/uv-lock-update.yml New scheduled workflow to regularly update uv.lock.
.github/workflows/test-python.yml Adds uv lock --check and removes the custom exclude-newer action usage.
.github/dependabot.yml Disables routine uv version-update PRs (handled by the scheduled uv-lock-update workflow).
.github/actions/set-uv-exclude-newer/action.yml Removes the custom action previously used to set UV_EXCLUDE_NEWER.
.evergreen/run-mongodb-aws-ecs-test.sh Stops deleting uv.lock, aligning with committed lockfile usage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return string_opts
if string_opts is not None:
raise ConfigurationError("Cannot set both string_opts and text_opts")
warnings.warn(
stacklevel=3,
)
return text_opts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants