-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add support for multiple sql statements in single request #40
Conversation
test "handles multi-statement requests", c do | ||
assert {:ok, %Avalanche.Result{statement_handles: statement_handles} = result} = | ||
Avalanche.run("begin transaction;select ?;select ? as two;commit;", [1, 2], [], c.options) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that for parameter substitution this is still treated as one statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result from run
is for all statements together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha this is so cool
assert result.status == :complete | ||
assert length(statement_handles) == 4 | ||
|
||
[sh1, sh2, sh3, sh4] = statement_handles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need the results from one or more of the statements, you need to know which one it was in the order, get that statement handle, and then call status
to get the results.
[sh1, sh2, sh3, sh4] = statement_handles | ||
|
||
assert {:ok, %Avalanche.Result{rows: [%{"status" => "Statement executed successfully."}]}} = | ||
Avalanche.status(sh1, [], c.options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is begin transaction;
.
assert {:ok, %Avalanche.Result{rows: [%{"TWO" => 2.0}]}} = Avalanche.status(sh3, [], c.options) | ||
|
||
assert {:ok, %Avalanche.Result{rows: [%{"status" => "Statement executed successfully."}]}} = | ||
Avalanche.status(sh4, [], c.options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is commit;
.
|
||
assert {:ok, %Avalanche.Result{} = result2} = | ||
Avalanche.run( | ||
"SELECT * FROM SNOWFLAKE_SAMPLE_DATA.WEATHER.DAILY_14_TOTAL LIMIT 1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SNOWFLAKE_SAMPLE_DATA.WEATHER
was removed by Snowflake.
🎉 This PR is included in version 0.12.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
See: