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

Append to a batch transactionally #1225

Closed
yujiarista opened this issue Mar 6, 2024 · 2 comments
Closed

Append to a batch transactionally #1225

yujiarista opened this issue Mar 6, 2024 · 2 comments

Comments

@yujiarista
Copy link
Contributor

Currently if I append a row with bad data to a batch, the batch is basically ruined.
Can we add a transactional semantic to Batch.Append so no data is appended to any column if there is an error?

@yujiarista yujiarista changed the title Clear bad data from a batch Transactional append to a batch Mar 6, 2024
@yujiarista yujiarista changed the title Transactional append to a batch Append to a batch transactionally Mar 6, 2024
@threadedstream
Copy link
Contributor

threadedstream commented Mar 7, 2024

I think it can be resolved by following the template below

func append() (err error) {
   batch := conn.PrepareBatch(...)
   defer func() {
     if err != nil {
        err = batch.Abort()
        return
     }
     err = batch.Send()
   }
   .....
}

Maybe you have a different case where template above doesn't work

@yujiarista
Copy link
Contributor Author

My suggestion is basically the same as #1223. Closing this one.

@yujiarista yujiarista closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants