Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAConnection twophase methods are broken #886

Open
1 task done
gistart opened this issue Dec 16, 2021 · 0 comments · May be fixed by #887
Open
1 task done

SAConnection twophase methods are broken #886

gistart opened this issue Dec 16, 2021 · 0 comments · May be fixed by #887
Labels

Comments

@gistart
Copy link

gistart commented Dec 16, 2021

Describe the bug

  1. begin_twophase() is not a context manager
  2. recover_twophase() is broken
  3. rollback_prepared() is broken

To Reproduce

just use these methods)

Expected behavior

  1. begin_twophase() behaves as a context manager, using commit_prepared() at the end OR docs changed to reflect current implementation
  2. does not crash on accessing ResultProxy
  3. does not crash on string formatting

Logs/tracebacks

1. begin_context() is not a context

According to docs: https://aiopg.readthedocs.io/en/stable/sa.html#aiopg.sa.SAConnection.begin_twophase

coroutine async-with begin_twophase(xid=None)

but in reality:

    async with conn.begin_twophase() as transaction:
AttributeError: __aenter__

2. recover_twophase() is broken

result is not awaited:

  File "/Users/ovmikhaylov/work/aiopg/aiopg/sa/connection.py", line 363, in recover_twophase
    return [row[0] for row in result]
TypeError: 'ResultProxy' object is not iterable

3. rollback_prepared() is broken

Due to error in f-string:

  File "/Users/ovmikhaylov/work/aiopg/aiopg/sa/connection.py", line 368, in rollback_prepared
    await self.execute(f"ROLLBACK PREPARED {xid:!r}")
ValueError: Invalid format specifier

Python Version

3.10

aiopg Version

1.3.3

OS

Darwin gmbp.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@gistart gistart added the bug label Dec 16, 2021
gistart pushed a commit to gistart/aiopg that referenced this issue Dec 16, 2021
@gistart gistart linked a pull request Dec 16, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant