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

Fix Cortex provider for tests. #1666

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

sfc-gh-dkurokawa
Copy link
Contributor

@sfc-gh-dkurokawa sfc-gh-dkurokawa commented Nov 25, 2024

Description

Fix Cortex provider for tests.

Other details good to know for developers

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • New Tests
  • This change includes re-generated golden test results
  • This change requires a documentation update

Important

Fixes Cortex provider's Snowflake session handling by introducing a default session and updating test setup.

  • Cortex Provider:
    • Adds DEFAULT_SNOWPARK_SESSION to Cortex class in provider.py for default session handling.
    • Updates session initialization to use DEFAULT_SNOWPARK_SESSION if no session is provided or if pyschema_utils.is_noserio() returns true.
    • Raises ValueError if session inference fails, suggesting setting DEFAULT_SNOWPARK_SESSION.
  • Testing:
    • Sets Cortex.DEFAULT_SNOWPARK_SESSION in setUp() of SnowflakeTestCase in snowflake_test_case.py to ensure consistent session usage across tests.
  • Makefile:
    • Adds test-snowflake target for running Snowflake-specific tests.

This description was created by Ellipsis for 0e17bc1. It will automatically update as commits are pushed.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 25, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

)
):
if (
hasattr(self, "DEFAULT_SNOWPARK_SESSION")
Copy link
Contributor

Choose a reason for hiding this comment

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

The hasattr check for DEFAULT_SNOWPARK_SESSION is redundant since it's a class variable and will always exist. Directly check if self.DEFAULT_SNOWPARK_SESSION is not None. This applies to line 110.

Suggested change
hasattr(self, "DEFAULT_SNOWPARK_SESSION")
self.DEFAULT_SNOWPARK_SESSION is not None

@@ -100,12 +103,30 @@ def __init__(
*args, **kwargs
)

self_kwargs["snowpark_session"] = (
if snowpark_session is None or pyschema_utils.is_noserio(
Copy link
Contributor

@sfc-gh-dhuang sfc-gh-dhuang Nov 25, 2024

Choose a reason for hiding this comment

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

ah thanks for fixing this - I missed checking explicitly the case where session exists but non-serializable

@sfc-gh-dkurokawa sfc-gh-dkurokawa merged commit c41bb59 into main Nov 25, 2024
9 of 10 checks passed
@sfc-gh-dkurokawa sfc-gh-dkurokawa deleted the davidkurokawa/fix_cortex_ff_provider branch November 25, 2024 18:55
@sfc-gh-chu sfc-gh-chu mentioned this pull request Dec 3, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants