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

Support for batching programatic migrations #39

Open
mbossenbroek opened this issue Aug 22, 2017 · 1 comment
Open

Support for batching programatic migrations #39

mbossenbroek opened this issue Aug 22, 2017 · 1 comment

Comments

@mbossenbroek
Copy link

Is there support for batching transactions where you specify a norm as a function that returns a set of transaction data? In a lot of cases for us, the migration data is far too large to transact as a single transaction.

This is what I'm using today to partition it into many smaller transactions:

(defn run-update
  "Run an update query; likely related to a schema migration"
  [connection q]
  (let [db (d/db connection)]
    (->>
      (q db)
      (partition-all 100)
      (reduce (fn [running-total tx-data]
                (let [total (+ (count tx-data) running-total)]
                  (log/infof "Running update tx %d" total)
                  (d/transact connection tx-data)
                  total)) 0))))
@avescodes
Copy link
Owner

I don't believe there is currently. There's good documentation on pipelining transactions. I'm not able to take this on right now, but I'm open to others trying.

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

No branches or pull requests

2 participants