Skip to content
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-834366 Fall back to use current schema for temp objects in write… #1617

Merged
merged 2 commits into from
Jun 28, 2023

Conversation

sfc-gh-sfan
Copy link
Contributor

…_pandas

Description

In 3.0.0 we made a change to use target schema for temp stage and file format, but this breaks user when they only have stage/file format creation privilege in current schema, but not the target schema.

This change adds a fallback mechanism to use current schema if creating temp object fails on target schema.

Testing

integ test

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-834366

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am modifying authorization mechanisms
    • I am adding new credentials
    • I am modifying OCSP code
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

…_pandas

Description

In 3.0.0 we made a change to use target schema for temp stage and file format,
but this breaks user when they only have stage/file format creation privilege
in current schema, but not the target schema.

This change adds a fallback mechanism to use current schema if creating temp
object fails on target schema.

Testing

integ test
@sfc-gh-sfan sfc-gh-sfan requested review from a team, sfc-gh-aling, sfc-gh-hpu, sfc-gh-jdu and sfc-gh-stan and removed request for a team June 26, 2023 21:43
Comment on lines +105 to +107
_do_create_temp_stage(
cursor, stage_location, compression, auto_create_table, overwrite
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we creating temp stage again if we encountered an exception?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, I see. This will use current_schema instead of temp schema

@sfc-gh-aalam
Copy link
Collaborator

Would this change also need to go in sproc-connector as the issue which caused this came from stored procs?

@sfc-gh-sfan
Copy link
Contributor Author

Would this change also need to go in sproc-connector as the issue which caused this came from stored procs?

Yes. I'm working on the sp connector changes :)

@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Merging #1617 (636f7a0) into main (48d8d3f) will increase coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 636f7a0 differs from pull request most recent head e8695ab. Consider uploading reports for the commit e8695ab to get more accurate results

@@            Coverage Diff             @@
##             main    #1617      +/-   ##
==========================================
+ Coverage   82.66%   82.71%   +0.05%     
==========================================
  Files          64       64              
  Lines        8992     9013      +21     
  Branches     1331     1331              
==========================================
+ Hits         7433     7455      +22     
+ Misses       1220     1219       -1     
  Partials      339      339              
Impacted Files Coverage Δ
src/snowflake/connector/pandas_tools.py 86.71% <100.00%> (+2.60%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sfc-gh-sfan sfc-gh-sfan merged commit f8be62d into main Jun 28, 2023
@sfc-gh-sfan sfc-gh-sfan deleted the shixuan_temp_stage branch June 28, 2023 01:07
@github-actions github-actions bot locked and limited conversation to collaborators Jun 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants