Skip to content

chore(mssql): always append semicolon to statement#11732

Merged
gforsyth merged 2 commits intoibis-project:mainfrom
deepyaman:chore/mssql/always-add-semicolon
Nov 2, 2025
Merged

chore(mssql): always append semicolon to statement#11732
gforsyth merged 2 commits intoibis-project:mainfrom
deepyaman:chore/mssql/always-add-semicolon

Conversation

@deepyaman
Copy link
Copy Markdown
Collaborator

Description of changes

Terminate all MSSQL statements with a semicolon. This is required for some statements (e.g. MERGE).

Raising a separate PR so that this broader change (not solely affecting Backend.upsert() implementation) is reflected in the changelog. All tests pass as-is.

@github-actions github-actions bot added the mssql The Microsoft SQL Server backend label Nov 2, 2025
# Although the semicolon isn't required for most statements, the
# T-SQL docs state that it will be required in a future version.
# https://learn.microsoft.com/en-us/sql/t-sql/language-elements/transact-sql-syntax-conventions-transact-sql?view=sql-server-ver17&tabs=code
query = f"{query};"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we check if the semicolon is already present and then suffix it if not?
If sqlglot adds in the semicolon in response to the upstream change in tsql we'll want to avoid doubling it up, I think

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, with an rstrip() for good measure: cf07db4

Copy link
Copy Markdown
Member

@gforsyth gforsyth left a comment

Choose a reason for hiding this comment

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

:shipit:

@gforsyth gforsyth enabled auto-merge (squash) November 2, 2025 15:24
@gforsyth gforsyth merged commit 8161b86 into ibis-project:main Nov 2, 2025
111 checks passed
@deepyaman deepyaman deleted the chore/mssql/always-add-semicolon branch November 2, 2025 16:45
@deepyaman
Copy link
Copy Markdown
Collaborator Author

@gforsyth Any chance I could interest you in also taking a look at #11624? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mssql The Microsoft SQL Server backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants