-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add client_session_keep_alive parameter for Snowflake connection #970
Add client_session_keep_alive parameter for Snowflake connection #970
Conversation
Thanks for the PR @borisuvarov! This is a really clever implementation! I'm probably not the right person to review this anymore, but someone from Fishtown will take a look :) |
Looks like there is a permission issue when running an AppVeyor build https://ci.appveyor.com/project/DrewBanin/dbt/build/1.0.1426-development:
Could you please clarify if should it be fixed on your side, or there is a problem in my PR? Thanks! |
I think that CI failure has to do with the deletion of this line: https://github.com/fishtown-analytics/dbt/pull/970/files#diff-12e0c6e7584ec33b980b924983dab7eeL133 |
It could also be related to this change: https://github.com/fishtown-analytics/dbt/pull/970/files#diff-12e0c6e7584ec33b980b924983dab7eeL21 |
@drewbanin Thanks a lot, and sorry about this. My bad! Fixed, let's see if it helps. |
@cmcarthur @drewbanin Hey guys, could you please take a quick look if you get a chance? It would be great to know if this PR is acceptable, or should I adjust/improve it somehow. Sorry for bugging you, but we're still suffering from this timeout issue. Thanks in advance! |
hey - thanks for the ping @borisuvarov! @beckjake and I spoke about this the other day and then we lost track of it! I think this is a really clever approach, but I worry that it might be too clever. It's difficult to manage threads in Python when errors occur, and a hanging thread can prevent dbt from exiting. So, if we need to do this, I'm into it, but I'd prefer an approach that doesn't require threading if possible. Did you already evaluate setting I'm digging in to find out how to set I am very happy to discuss - let me know what you think! And thanks again for following up :) |
Hey Drew, I totally understand your concerns about threads, but looks like CLIENT_SESSION_KEEP_ALIVE is available only in ODBC and JDBC clients, but not in their Python connector: https://docs.snowflake.net/manuals/sql-reference/parameters.html#client-session-keep-alive I'll try to reach out, maybe I'll manage to add that parameter into the Python Snowflake connector. I'll get back to you with an answer from Snowflake guys. Thanks! |
ah!
That's annoying -- i figured we could just run a query to set that on every connection, but looks like that won't work either. I think reaching out is definitely the move! Let me know how it goes! |
Please see the discussion here: snowflakedb/snowflake-connector-python#104 |
Thanks to https://github.com/smtakeda, the CLIENT_SESSION_KEEP_ALIVE is going to be included into the upcoming 1.6.10 release of the Snowflake Python connector: snowflakedb/snowflake-connector-python@2ad0269#diff-9bafad465c7c8135c979e1e45c1e9102R14 I'll update this PR tomorrow. |
Thanks @borisuvarov - this is exciting! Let's be sure to close our connections:
This would prevent dbt from exiting, I think. I'd also like to bypass this code entirely if possible, as users who don't set a keepalive shouldn't be impacted by any threading issues like this. Looking forward to the updated PR! |
Hey @drewbanin, could you please take a look? Actually now it's just one line. :-) Thanks! |
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.
Hi @borisuvarov, this looks mostly great to me, I had one review comment.
Also, could you please rebase this against the branch named dev/guion-bluford
and change the PR to be against that? It's our current 'dev' branch that will most likely become our next release.
dbt/adapters/snowflake/impl.py
Outdated
autocommit=False | ||
autocommit=False, | ||
client_session_keep_alive=credentials.get( | ||
'client_session_keep_alive') |
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.
I think this should have a , False
so the default is False
, not None
.
…o prevent session timeout after 4 hours of inactivity
Hey @beckjake, thanks for your review! I've fixed this PR accordingly to your comments, please have a look when you get a chance. |
Looks great, thanks! I've triggered the non-windows tests for completeness, once those pass (and I assume they will) this will be ready to merge. |
This is a way to mitigate the issue #827 (prevent session timeout after 4 hours of inactivity).
Hey @drewbanin, could you please take a look if you get a chance? Thanks in advance!