-
Notifications
You must be signed in to change notification settings - Fork 116
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-919476: Do not ignore stage location for using imports when is_permanent is False #1053
SNOW-919476: Do not ignore stage location for using imports when is_permanent is False #1053
Conversation
…ermanent is False
PR for fixing the merge-gate failures is here: #1054 |
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 sure if this is the desired behavior (e.g. upload the udf zip file into a permanent stage location for a temp UDF). Can we instead separate the concern of upload and imports? For example, we could have an upload stage and an import stage.
This is a really good suggestion. I have updated the code to use this logic because I got confused about the context and started looking at stage location only as an upload location. This is the desired behavior from temp sprocs:
|
…manent-stage-location
src/snowflake/snowpark/session.py
Outdated
# probably shouldn't do it. It is already done in resolve_imports_and_pacakges | ||
normalized_import_location = unwrap_stage_location_single_quote(import_stage) |
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.
Can we verify if this could lead to bugs (e.g. over-unwrapping)?
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.
there are some tests in test_utils_suite.py/test_normalize_stage_location
which test for this.
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.
Added more tests. Overwrapping does not lead to bugs
Let's make sure this is documented and tested :) |
Yep. I'm working on the tests now. |
@@ -821,6 +816,12 @@ def resolve_imports_and_packages( | |||
else session.get_session_stage() | |||
) | |||
|
|||
import_stage = ( |
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.
Let's define import_stage first then upload_stage = import_stage if is_permanent else session_stage
.
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 wonder if there's a better name for upload_stage
, because technically we need to upload files to import_stage
too. How about something like sproc_stage
vs import_stage
?
In addition, could you please add a one line documentation for these args to clarify?
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 agree with your point but the stage is used for udfs as well. How about import_only_stage
and upload_and_import_stage
?
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 don't think we upload files to import stage, but it is the other way around (we import the upload stage). And as Afroz mentioned, the import/upload difference is application to UDF families as well. I cannot come up with a better name than what Afroz suggested.
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.
done
src/snowflake/snowpark/session.py
Outdated
stage_location, statement_params=statement_params | ||
import_only_stage, statement_params=statement_params | ||
) | ||
# probably shouldn't do it. It is already done in resolve_imports_and_pacakges |
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.
Let's remove this comment if we already have tests :p
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes #SNOW-919476
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.