SNOW-502598: Enable executing queries with asyncExec: true
#592
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
My team is using the JavaScript Snowflake SDK. We need to be able to execute queries without waiting for the result. I see that the JavaScript Snowflake SDK has functionality for polling query results, a Result class, a RowStream class, etc.; however, it would be sufficient for us if we could just issue a request with
asyncExec: true
, get the Snowflake query ID back, and then monitor the query ourselves (for example, using RESULT_SCAN).With this in mind, I've tried to create a small patch that does just that. This may partially address SNOW-502598 (see #486 and #208). I've also prepared a patch for @types/snowflake-sdk:
If you use Yarn v2 or later, you can try these changes out by
git@github.com:propeldata/snowflake-connector-nodejs.git#head=asyncExec
yarn patch
to apply the @types/snowflake-sdk patch above.Warning
This is definitely a hack, because the JavaScript Snowflake SDK's
execute
method is supposed to return a Statement object with APIs you can invoke, likegetColumns
andstreamRows
. These are probably not working with this patch; however, my team does not use these APIs anyway. We typically invoke the JavaScript Snowflake SDK as follows:I would look to the JavaScript Snowflake SDK team for ideas on how to better integrate this functionality with the Statement object. Perhaps, when
asyncExec: true
is set, we should just synthesize a Result with a RowStream containing a singular row. That singular row could contain a singular column with the query ID. Maybe this would make sense?Checklist
npm run lint:check -- CHANGED_FILES
and fix problems in changed code)npm run test:unit
andnpm run test:integration
)