-
Notifications
You must be signed in to change notification settings - Fork 122
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
SNOW-1976643: Allow creating multi-session in sprocs if enabled #3146
base: main
Are you sure you want to change the base?
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
src/snowflake/snowpark/session.py
Outdated
if len(_active_sessions) >= 1 and is_in_stored_procedure(): | ||
if (len(_active_sessions) >= 1 | ||
and is_in_stored_procedure() | ||
and not conn._get_client_side_session_parameter( |
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 param will be enabled for internal dbt use only.
7cdcc9a
to
a36861f
Compare
len(_active_sessions) >= 1 | ||
and is_in_stored_procedure() | ||
and not conn._get_client_side_session_parameter( | ||
"ENABLE_CREATE_SESSION_IN_STORED_PROCS", False |
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.
ENABLE_CREATE_SESSION_IN_STORED_PROCS
is an internal param that will be only enabled for internal dbt runs.
With dbt project, we are planning on supporting multiple session insides procs. So we have added new API to _snowflake to create a pristine cloned version of the default server session. Using this, we will create a new new Snowpark session (a new object with new connection obj) and we will set the session_id of the connection (will be done in C API). Currently we have a check in Snowpark lib which disallows creating multiple sessions inside sprocs. With this check we will that check the corresponding param is enabled (this param will only be enabled for dbt sprocs).
For more info on the multi-session project see this design doc: https://docs.google.com/document/d/1lwqyykHo549Vx3UWpFLWot1LIdYrwUjGKtGbQGaCnd8/edit?tab=t.0#heading=h.sil75ywnlm6n
An example of how this new API is used:
Fill out the following pre-review checklist: