-
Notifications
You must be signed in to change notification settings - Fork 544
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 mode #917
base: main
Are you sure you want to change the base?
Autocommit mode #917
Conversation
Unit tests are failing with a unicode error there in |
I think that the reason of the failure is that the new Also, I'm not sure if those typecasters should be moved only onto the new Finally, in the method |
Codecov Report
@@ Coverage Diff @@
## master #917 +/- ##
==========================================
- Coverage 84.57% 84.05% -0.52%
==========================================
Files 21 21
Lines 2463 2496 +33
==========================================
+ Hits 2083 2098 +15
- Misses 380 398 +18
Continue to review full report at Codecov.
|
Thank you for having a look at this PR. |
b36bd23
to
ec4511c
Compare
Use different connection for user queries Add settings for autocommit
@gma2th I looked through the PR and I have 2 questions. Let me preface these comments by saying, I would like to minimize the number of configuration options in pgcli. It is wise to choose sensible defaults wherever possible.
|
Hrm. Even when I set the |
Any updates on this? I've been interested in this feature for quite a while. |
Hello, could we get this merged? I want to be able to set autocommit off when accessing important databases :) |
@quezak This PR has a couple of outstanding questions, and needs a rebase on master. We've heard nothing from @gma2th in a long time, and I don't think they are interested in finishing the work. Perhaps you'd be interested to pick up and continue working on this feature, by forking pgcli master and porting over these changes? |
I see. Let's see if we're able to solve the questions and I could be able to help if it's not too complicated :)
I'd like to have autocommit always disabled when I access a production database that's generally not operated manually -- just in case I hit enter without thinking twice :) But on a dev or local instance I'm fine with having autocommit on.
I agree, but also I'd like to have some way to disable autocommit for some databases as described above. I think it would be good to at least limit the number of CLI parameters -- this PR proposes two of them, #535 another one, and at a glance I see more cases in open issues. Maybe it would be nice to come up with a more general solution to allow overriding some config vars from CLI and/or per different databases? I've dropped a few ideas in #535 (comment), but I don't know where would be a good place to discuss it. |
If anyone could work on this and get it merged, it would be greatly appreciated. This increased safety would be beneficial. I am not super familiar with Python. Otherwise, I would consider jumping and trying this myself. |
Description
Add autocommit mode.
Add on error rollback.
When autocommit_mode is set to false, users can manually commit or rollback the current transaction.
When on_error_rollback is set to true, if a statement in a transaction block generates an error, the error is ignored and the transaction continues.
In order to deactivate autocommit for users transactions, without messing up with intern pgcli transactions, we better use two different connections.
Requested here #410
Limitation
Users are not able to activate/disable autocommit from the UI.
Autocommit has to be activated in order to use on error rollback.
No tests to cover the change.
Ressource
Checklist
changelog.rst
.AUTHORS
file (or it's already there).