spinframework / spinframework/spin

Add first-class transaction support for DBMS in Spin SDKs

Open
#2,286 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement sdk
Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

It would be really handy to have first-class support for transactions when interacting with DBMS like PostgreSQL or MySQL.

As of today it is possible to concat multiple commands and surround those with BEGIN and COMMIT to use transactions. Although this works, it comes at the cost of ending up with longer TSQL statements.

In contrast, having first-class support for transactions, would result in

  • cleaner representation in code
  • prevent myself from writing even more plain TSQL
  • have compile-time check

See the following (pseudo-code) for illustration.

// ...
let connection = Connection::open(connection_string)?;
let tx = connection::begin_transaction();

let res1 = tx.execute("MY 1ST COMMAND", &params);
let res2 = tx.execute("MY 2ND COMMAND", &params);

match tx.commit() {
  Ok(res) => ,   // ...
  Err(e) => tx.rollback(),      // ...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests. Start by locating the SDK connection flow represented by Connection::open and the proposed begin_transaction, execute, commit, and rollback calls, then compare current PostgreSQL and MySQL command handling. Done means a defined first-class transaction API with compile-time checking and documented commit or rollback behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, postgresql, rust
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.