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

Add an optional adapter interface for configuring transaction behavior #334

Closed
tconbeer opened this issue Nov 27, 2023 · 1 comment · Fixed by #537
Closed

Add an optional adapter interface for configuring transaction behavior #334

tconbeer opened this issue Nov 27, 2023 · 1 comment · Fixed by #537
Labels
adapter v2 enhancement New feature or request

Comments

@tconbeer
Copy link
Owner

tconbeer commented Nov 27, 2023

pg and sqlite are autocommit right now; this could be configurable...

Would be nice to have a checkbox (in the run query bar?) if the adapter supports this for enabling/disabling auto-commit.

@tconbeer tconbeer added the enhancement New feature or request label Nov 27, 2023
@tconbeer
Copy link
Owner Author

tconbeer commented Apr 25, 2024

Follow datagrip's lead:

Show a badge Tx: Auto; click that badge to switch to Tx: Manual.

Except that those states should be loadable from the adapter. So the adapter can declare a prop (class var) like TRANSACTION_MODES: list[str] = ["Auto", "Manual"],

The default mode should be configurable in a profile, although maybe that's a detail we leave to the adapter author. In that case, maybe the right interface is something like

@property
def transaction_mode(self) -> str:
   """the name of the currently-active transaction mode"""
    ...

def toggle_transaction_mode(self) -> str:
   """Switches to the next transaction mode and returns the name of the new mode"""
   ...

this interface would also be compatible with older adapter versions, which is nice. We could just take the empty string to mean "not implemented"

@tconbeer tconbeer mentioned this issue Apr 26, 2024
8 tasks
tconbeer added a commit that referenced this issue Apr 29, 2024
* feat: add transaction attrs to HarlequinConnection and SqliteHarlequinConnection

* feat: add transaction mode button

* fix: skip sqlite adapter txn test

* fix: add --snapshot-warn-unused in CI

* fix: run on macos-13, not latest (cache breaks?)

* feat: add commit and rollback buttons

* fix: move transaction mode class; update schema on commit

* fix: update tx button snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter v2 enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant