Enable client_session_keep_alive on Snowflake hook to survive long tasks#324
Merged
Conversation
Long-running ELT tasks (e.g. Amazon Brand Analytics Search Query Performance loads that take 1-4 hours) fail when using key-pair (JWT) auth because the JWT signed at connect-time expires 60 minutes later. Setting client_session_keep_alive=True makes the snowflake-connector send periodic /session/heartbeat requests that refresh the JWT in the background, keeping the session valid for the lifetime of the task. Verified end-to-end: heartbeat fires after ~15 min (connector-enforced minimum interval); 4-hour Snowflake-writing tasks now complete without the previous "JWT token is invalid" / "Authentication token expired" failures.
Contributor
|
The fix is correct and safe — Style
You can request a new review by commenting |
Contributor
|
Claude review cost: $0.2650 · 8 turns · 168s · |
Co-authored-by: gemma-claude-assistant[bot] <262789552+gemma-claude-assistant[bot]@users.noreply.github.com>
Contributor
|
Looks good — this is a small, targeted, correct fix for the JWT session-expiry problem on long-running tasks. You can request a new review by commenting |
Contributor
|
Claude review cost: $0.2433 · 7 turns · 151s · |
soltanianalytics
approved these changes
May 29, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Long-running ELT tasks using key-pair (JWT) auth on the EWAH Snowflake hook fail mid-task once the task runs longer than ~60 minutes — Snowflake caps JWT validity at 60 min and the connector does not refresh the JWT on its own, so the connection opened at task start dies before the task's final write.
Real-world trigger: Amazon Brand Analytics Search Query Performance loads where Amazon's report-ready polling stretches a task to 1–4 hours, and the closing `COPY INTO` then hits `JWT token is invalid` / `Authentication token has expired`.
Changes