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

fix(Microsoft SQL Node): Fix execute query to allow for non select query to run #11335

Conversation

ShireenMissi
Copy link
Contributor

@ShireenMissi ShireenMissi commented Oct 21, 2024

Summary

This PR fixes an issue in MS SQL Node execute query operation as it only worked for select queries before.
mssql returns the result as an object of type

export interface IResult<T> {
    recordsets: T extends any[] ? { [P in keyof T]: IRecordSet<T[P]> } : Array<IRecordSet<T>>;
    recordset: IRecordSet<T extends any[] ? T[0] : T>;
    rowsAffected: number[];
    output: { [key: string]: any };
}

by extracting recordsets and rowsAffected the execute query operation now supports all queries not just select queries.

Related Linear tickets, Github issues, and Community forum posts

https://linear.app/n8n/issue/NODE-1794/community-issue-mssql-result-is-not-iterable-internal-error
#11033

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@ShireenMissi ShireenMissi changed the title fix(Microsoft SQL Node): fix execute query to allow for non select query to run fix(Microsoft SQL Node): Fix execute query to allow for non select query to run Oct 21, 2024
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team node/improvement New feature or request labels Oct 21, 2024
Copy link
Member

@Joffcom Joffcom left a comment

Choose a reason for hiding this comment

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

Looks good, Tested with different options shown below.

Create
image

Delete
image

Select
image

Drop
image

Insert
image

Copy link

cypress bot commented Oct 22, 2024

n8n    Run #7484

Run Properties:  status check passed Passed #7484  •  git commit 1a77d91213: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ShireenMissi 🗃️ e2e/*
Project n8n
Branch Review node-1794-community-issue-mssql-result-is-not-iterable-internal-error
Run status status check passed Passed #7484
Run duration 04m 16s
Commit git commit 1a77d91213: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 ShireenMissi 🗃️ e2e/*
Committer Shireen Missi
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 1
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 458
View all changes introduced in this branch ↗︎

Copy link
Contributor

✅ All Cypress E2E specs passed

@Joffcom Joffcom merged commit ba158b4 into master Oct 22, 2024
33 of 36 checks passed
@Joffcom Joffcom deleted the node-1794-community-issue-mssql-result-is-not-iterable-internal-error branch October 22, 2024 09:58
@github-actions github-actions bot mentioned this pull request Oct 24, 2024
@janober
Copy link
Member

janober commented Oct 24, 2024

Got released with [email protected]

@Surenthiran
Copy link

thank you, guys. We really needed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team node/improvement New feature or request Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants