-
Notifications
You must be signed in to change notification settings - Fork 4k
Use the current active Snowpark session if one is available #6504
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
Use the current active Snowpark session if one is available #6504
Conversation
9a0b89c to
e684760
Compare
d979553 to
73b3c87
Compare
lukasmasuch
left a comment
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.
LGTM 👍
| # available, we just use that one. Otherwise, we fall back to attempting to | ||
| # create a new one from whatever credentials we have available. | ||
| try: | ||
| return get_active_session() |
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.
Is there a situation where the session returned by get_active_session is actually not what the user is trying to connect to? E.g. if the user is logged in with a certain account/role, but actually wants to use a different one?
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.
Not as far as I understand -- @sfc-gh-jcarroll might know if there's any weirdness that can go on here, though
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'm not aware of any either, I think this will work. Might be worth tagging Yijun on the main PR to look at the Snowpark connection all up for any concerns like this?
* Use the current active Snowpark session if one is available * Only run Snowpark tests in Snowflake CI tests * Add `type: ignore`s
* Use the current active Snowpark session if one is available * Only run Snowpark tests in Snowflake CI tests * Add `type: ignore`s
* Use the current active Snowpark session if one is available * Only run Snowpark tests in Snowflake CI tests * Add `type: ignore`s
📚 Context
This one's pretty self-explanatory. In some runtime environments, we'll already have an active
Snowpark session available (grabbing it is easy thanks to the Snowpark library's
get_active_sessionfunction). We just want to use this active session when possible.