metabase / metabase/toucan

Will not use Transaction when call db/insert with a binding to *db-connection*

Open
#82 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
576
Forks
48
PR merge metrics
No merged PRs in 30d

Description

@camsaul
We found when call db/transaction with a binding *db-connection*, it will never work, since the
connection function will always return *db-connection*. What I suggest is to adjust the priority to move *transaction-connection* to the top. I do some testing in my local env, it works.
(defn connection []
(or *transaction-connection* ;;fix the bug move transaction to the top, otherwise transaction will not work.
*db-connection*
@default-db-connection
(throw (Exception. "DB is not set up. Make sure to call set-default-db-connection! or bind *db-connection*.")))))))

Contributor guide

No contributing guide indexed for this repository

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

Start at the connection function shown in the issue and trace how db/transaction and db/insert resolve a bound *db-connection*. Inspect the surrounding database connection code and any existing transaction tests, then verify that a transaction-bound connection is selected and that the normal default connection behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.