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-2005198, SNOW-2014106: Add support for DataFrame/Series.create_or_replace_view #3198

Merged
merged 3 commits into from
Mar 28, 2025

Conversation

sfc-gh-helmeleegy
Copy link
Contributor

@sfc-gh-helmeleegy sfc-gh-helmeleegy commented Mar 26, 2025

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

    Fixes SNOW-2005198, SNOW-2014106

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
  3. Please describe how your code solves the related issue.

    Add support for DataFrame/Series.create_or_replace_view.

@sfc-gh-helmeleegy sfc-gh-helmeleegy force-pushed the helmeleegy-SNOW-2005198 branch from 0dd7a41 to 41a6831 Compare March 26, 2025 19:46
@@ -44,6 +44,7 @@ Series
Series.to_snowflake
Series.to_snowpark
Series.cache_result
Series.create_or_replace_view
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the view for a Series? will it be just a view with only 1 row (or column) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The view definition will be a query selecting the one data column of the series plus one or more index columns. But note that those columns could have been computed through more complex steps. For example, it may involve joining multiple tables, doing grouping and aggregation, etc until the final columns representing the series data and index columns are computed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But in general views have no rows. They are logical not physical.

@sfc-gh-snowflakedb-snyk-sa
Copy link

sfc-gh-snowflakedb-snyk-sa commented Mar 28, 2025

🎉 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)

@sfc-gh-helmeleegy sfc-gh-helmeleegy force-pushed the helmeleegy-SNOW-2005198 branch 4 times, most recently from 6b00b90 to 7bbf448 Compare March 28, 2025 05:12
@sfc-gh-helmeleegy sfc-gh-helmeleegy force-pushed the helmeleegy-SNOW-2005198 branch from 7bbf448 to 00e934a Compare March 28, 2025 05:20
@sfc-gh-helmeleegy sfc-gh-helmeleegy changed the title SNOW-2005198: Add support for DataFrame/Series.create_or_replace_view SNOW-2005198, SNOW-2014106: Add support for DataFrame/Series.create_or_replace_view Mar 28, 2025
Copy link
Contributor

@sfc-gh-nkumar sfc-gh-nkumar left a comment

Choose a reason for hiding this comment

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

Looks good.

statement_params: Optional[Dict[str, str]] = None,
) -> List[Row]:
"""
Creates a view that captures the computation expressed by this DataFrame.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be good to clarify that creation of view doesn't involve computing output of the whole dataframe/series.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is well understood for views -- that it doesn't involve materialization. Also, it's good to stay consistent with the documentation of snowpark python.

@sfc-gh-helmeleegy sfc-gh-helmeleegy merged commit c0d7b57 into main Mar 28, 2025
45 checks passed
@sfc-gh-helmeleegy sfc-gh-helmeleegy deleted the helmeleegy-SNOW-2005198 branch March 28, 2025 16:56
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants