Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add support for async query response #42

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sgrebnov
Copy link
Contributor

@sgrebnov sgrebnov commented May 6, 2024

Queries longer than 45s returns response as they were executed with exec_async=true parameter and needs additional logic to get result once it is available. PR adds async ExecResponse::QueryAsync response type and get_async_exec_result method to handle this case. Implementation is similar to Go (reference)

If async parameter is not specified or is set to false, a statement is executed and the results are returned if the execution is completed in 45 seconds. If the statement execution takes longer to complete, the statement handle is returned.https://docs.snowflake.com/en/developer-guide/sql-api/reference#query-parameters

Example response

{
  "data" : {
  "queryId" : "01b41e53-0002-66e9-005e-e38700025036",
  "getResultUrl" : "/queries/01b41e53-0002-66e9-005e-e38700025036/result",
  "queryAbortsAfterSecs" : 300,
  "progressDesc" : null
},
  "code" : "333334",
  "message" : "Asynchronous execution in progress. Use provided query id to perform query monitoring and management.",
  "success" : true
}

@sgrebnov sgrebnov force-pushed the sgrebnov/async-query branch from 2982264 to c8c6e73 Compare May 6, 2024 01:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants