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-911327: Use CTAS for save as table #1075

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

sfc-gh-aalam
Copy link
Contributor

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-912320: The behavior of save_as_table(mode='overwrite') is inconsistent between v1.5.1 and v1.6.1 #1046, #SNOW-911327

  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 adding new credentials
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    In PR SNOW-817445: Fix dataframe writer save_as_table allow nulls #895 we started using create-table-insert-values pattern instead of using a CTAS pattern for saving dataframes. This is causing issues for multiple users so we are using CTAS while also respecting nullable columns. The tests added before also work for the correctness of this change.

Comment on lines -2309 to -2313
@pytest.mark.parametrize("table_type", ["", "temp", "temporary", "transient"])
@pytest.mark.parametrize(
"save_mode", ["append", "overwrite", "ignore", "errorifexists"]
)
def test_save_as_table_respects_schema(session, save_mode, table_type):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing excessive table_type parametrization for tests which don't provide any additional value in the test. I do want to listen to team's opinion on this

@sfc-gh-aalam sfc-gh-aalam marked this pull request as ready for review October 3, 2023 22:44
@sfc-gh-aalam sfc-gh-aalam requested a review from a team as a code owner October 3, 2023 22:44
Copy link
Collaborator

@sfc-gh-sfan sfc-gh-sfan left a comment

Choose a reason for hiding this comment

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

To make sure I understand, we only revert the CTAS -> create and insert change, but not the original changes to allow nulls, right?

As for table_type, as long as we have one test that tests table_type, we should be okay.

@sfc-gh-aalam
Copy link
Contributor Author

sfc-gh-aalam commented Oct 3, 2023

To make sure I understand, we only revert the CTAS -> create and insert change, but not the original changes to allow nulls, right?

As for table_type, as long as we have one test that tests table_type, we should be okay.

We only revert CTAS -> create+insert statement but keeping the NULL changes. In the first PR, I didn't know it was possible to enforce schema nulls using CTAS until yijun showed it to me. Note we haven't removed any nullable schema tests that were added earlier.

@sfc-gh-aalam sfc-gh-aalam merged commit eceeb36 into main Oct 4, 2023
49 of 50 checks passed
@sfc-gh-aalam sfc-gh-aalam deleted the aalam-SNOW-911327-use-ctas-for-save-as-table branch October 4, 2023 18:48
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 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.

SNOW-912320: The behavior of save_as_table(mode='overwrite') is inconsistent between v1.5.1 and v1.6.1
2 participants