Skip to content

Add __iter__ method to TracedCursorProxy#4427

Merged
xrmx merged 14 commits intoopen-telemetry:mainfrom
lrafeei:main
Apr 20, 2026
Merged

Add __iter__ method to TracedCursorProxy#4427
xrmx merged 14 commits intoopen-telemetry:mainfrom
lrafeei:main

Conversation

@lrafeei
Copy link
Copy Markdown
Contributor

@lrafeei lrafeei commented Apr 13, 2026

Description

During the upgrade to support wrapt v2.0, the inherited class for TracedCursorProxy in opentelemetry/instrumentation/dbapi/__init__.py was changed to BaseObjectProxy. One of the changes in wrapt v2.0 is that the BaseObjectProxy no longer provides a proxy implementation for the __iter__() method. The issue with this is that the DBAPI cursor is an iterable, so this breaks any potential instrumentation relying on this. As a fix, an __iter__() method is added to the TracedCursorProxy class.

Refs #4462

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Existing tests re-run
  • A new test was added to test this functionality

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 13, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@lrafeei lrafeei marked this pull request as ready for review April 13, 2026 23:59
@lrafeei lrafeei requested a review from xrmx April 14, 2026 17:28
@xrmx xrmx moved this from Reviewed PRs that need fixes to Easy to review / merge / close in Python PR digest Apr 15, 2026
@xrmx xrmx moved this from Easy to review / merge / close to Reviewed PRs that need fixes in Python PR digest Apr 16, 2026
@xrmx xrmx mentioned this pull request Apr 17, 2026
4 tasks
@lrafeei lrafeei requested a review from a team as a code owner April 17, 2026 20:27
@lrafeei lrafeei requested a review from xrmx April 17, 2026 22:24
@github-project-automation github-project-automation Bot moved this from Reviewed PRs that need fixes to Approved PRs in Python PR digest Apr 20, 2026
@xrmx xrmx merged commit 3ece058 into open-telemetry:main Apr 20, 2026
750 of 751 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Apr 20, 2026
xrmx added a commit to xrmx/opentelemetry-python-contrib that referenced this pull request Apr 24, 2026
* Add iter to TracedCursorProxy

* Add test to verify cursor is iterable

* Disable linter rule for dbapi iter test

* Add __iter__ to MockCursor

* Add mysql docker tests

* Push linter fixes

* Update docs-requirements.txt

* Update CHANGELOG.md

* Update nitpick-exceptions.ini

---------

Co-authored-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
xrmx added a commit that referenced this pull request Apr 24, 2026
* Add iter to TracedCursorProxy

* Add test to verify cursor is iterable

* Disable linter rule for dbapi iter test

* Add __iter__ to MockCursor

* Add mysql docker tests

* Push linter fixes

* Update docs-requirements.txt

* Update CHANGELOG.md

* Update nitpick-exceptions.ini

---------

Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants