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 MSSQL batch statements (Resolves #652) #666

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

glebteterin
Copy link

The sql query gets split to batches with https://github.com/denisenkom/go-mssqldb/blob/master/batch/batch.go
Resolves #652 and #466

@coveralls
Copy link

coveralls commented Dec 8, 2021

Pull Request Test Coverage Report for Build 2245625366

  • 18 of 23 (78.26%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 57.861%

Changes Missing Coverage Covered Lines Changed/Added Lines %
database/sqlserver/sqlserver.go 18 23 78.26%
Totals Coverage Status
Change from base Build 1997075650: 0.05%
Covered Lines: 3754
Relevant Lines: 6488

💛 - Coveralls

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

For safety, make this optional. e.g. x-batch.
See the postgres db driver's x-multi-statement for an example

@jfhbrook-at-work
Copy link
Contributor

@dhui thanks for taking a look at this. I can definitely look into those flags and at least confirm that the SQL Server tests pass, though like in #714 I probably won't tackle unrelated failures with other databases. Hopefully next week!

@glebteterin
Copy link
Author

Thanks, @dhui. I'll look into those flags and add something by the next week

@jfhbrook-at-work
Copy link
Contributor

@glebteterin heads up, I suspect that the changes merged in #714 will help you get passing sqlserver tests - they were broken for me prior to those changes, so be sure to pull them in!

@tmeckel
Copy link

tmeckel commented Apr 6, 2022

@jfhbrook-at-work can this be merged any time soon? I'm currently struggling with a migration that contains a couple of functions that can only be deployed to the database schema as a single batch statement.

@jfhbrook-at-work
Copy link
Contributor

@tmeckel My team decided to make an internal fork and float this patch, rather than working to push it across the finish line. I can tell you, though, that this patch works fine for us - tests included.

@tmeckel
Copy link

tmeckel commented Apr 6, 2022

@jfhbrook-at-work thanks for the quick answer! So, for me it seems I either have to build a version on my own with this patch included or I wait for the team to implement this functionality aside this PR. If so, is there a time frame in which the functionality will be provided in an official build?

@jfhbrook-at-work
Copy link
Contributor

I would say "when someone addresses the open issues in the PR". That's not gonna be me today - perhaps it will be you?

@tmeckel
Copy link

tmeckel commented Apr 6, 2022

@jfhbrook-at-work Okay, so the open issues are the ones @dhui mentioned in #666 (review)?

@jfhbrook-at-work
Copy link
Contributor

That's my understanding, yes.

@tmeckel
Copy link

tmeckel commented Apr 6, 2022

@jfhbrook-at-work I just had a quick look how the stuff is implemented in the Postgres driver. Very straight forward. But I don't want to simply "hijack" the PR.

@glebteterin will you have any time soon to implement the changes requested by @dhui

@glebteterin
Copy link
Author

The required changes are done, but I'm getting some flaky errors. @dhui any ideas what could it be?

@tmeckel
Copy link

tmeckel commented Apr 21, 2022

@glebteterin seems to me that the GitHub build agent wasn't able to start the database containers correctly. When I look over the build logs every single database test failed because the TCP connections couldn't be established. @jfhbrook-at-work can you restart the CI build? Perhaps this error was transient.

@Fontinalis Fontinalis added this to the v4.16.0 milestone Apr 27, 2022
@Fontinalis Fontinalis added the database Updates database drivers label Apr 29, 2022
@Fontinalis Fontinalis self-assigned this Apr 29, 2022
@tmeckel
Copy link

tmeckel commented Apr 29, 2022

@Fontinalis YEAH 🕺🏻 can't wait to get this merged 👍🏼 😄

@Fontinalis
Copy link
Member

@tmeckel Gonna check it one last time and merge it either this weekend or Monday. Had some last minute things coming up..

@tmeckel
Copy link

tmeckel commented Jul 24, 2022

@tmeckel Gonna check it one last time and merge it either this weekend or Monday. Had some last minute things coming up..

@Fontinalis will this PR merged soon?

@dhui
Copy link
Member

dhui commented Jul 27, 2022

FYI, this PR will need to be updated after #758 is merged

@nishant-shah-social
Copy link

Hello,
Thanks for this PR
I am also encountering this issue and have a need to support MSSQL batch statements in our migrate sql scripts.
I see the #758 is now merged.
@dhui @Fontinalis any chances of this PR also getting merged anytime soon?

@fildenisov
Copy link

Hi,
Could you please finally merge it?

@meetsoni15
Copy link

Hello, Could anyone please merge this PR ?

@ericsampson
Copy link

@dhui would it be possible to merge this if someone addresses any remaining PR comments?

We've been using it in a forked version for a year with no issues, but it would sure be nice if we could stop having to use/maintain our fork and just use the upstream : )

Cheers!

@ericsampson
Copy link

Ping @dhui, is there anything I can do to help get this PR merged in?

We've tested it for a year now and it works fine.

Thanks!!

@JorisHeadease
Copy link

Any update on this PR @Fontinalis? Not having this functionality is quite a big drawback!

JorisHeadease added a commit to nuts-foundation/nuts-node that referenced this pull request Apr 22, 2024
…to missing batch functionality (see golang-migrate/migrate#756 & golang-migrate/migrate#666).

Also added 2 missing drop index statements in the golang-migrate down scripts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Updates database drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for MSSQL batch statements (GO) using the existing support in go-mssqldb