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

Autocommit #1354

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Autocommit #1354

wants to merge 4 commits into from

Conversation

vanviegen
Copy link

@vanviegen vanviegen commented Jul 6, 2022

Description

  • Toggle autocommit mode using F6 or a config setting.
  • When in a transaction, rollback erring queries without aborting the transaction. ('On error rollback'.)

Closes #410. This work is loosely based on PR #917 by Matthieu Guilbert, but attempts to keep things simpler. I'm no PostgreSQL expert, so reviewers are encouraged to look for edge cases that make this simpler approach fall apart.

Checklist

  • I've added this contribution to the changelog.rst.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
    --> I'm getting (no files to check) Skipped.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

@vanviegen vanviegen mentioned this pull request Jul 7, 2022
4 tasks
@j-bennet
Copy link
Contributor

j-bennet commented Sep 2, 2022

Hi @vanviegen , you need this change in test_pgexecute to fix the failing test:

diff --git a/tests/test_pgexecute.py b/tests/test_pgexecute.py
index 7fef4658..882c4845 100644
--- a/tests/test_pgexecute.py
+++ b/tests/test_pgexecute.py
@@ -527,6 +527,12 @@ class VirtualCursor:
         self.protocol_error = True
         self.protocol_message = "Command not supported"

+    def __enter__(self):
+        return self
+
+    def __exit__(self, exc_type, exc_value, exc_tb):
+        return self
+

Please give it a try. I have no permissions to push to your fork.

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.

Transactions
2 participants