Skip to content

SNOW-2241913: non-retryable error handling#3770

Merged
sfc-gh-yuwang merged 19 commits into
mainfrom
SNOW-2241913
Sep 30, 2025
Merged

SNOW-2241913: non-retryable error handling#3770
sfc-gh-yuwang merged 19 commits into
mainfrom
SNOW-2241913

Conversation

@sfc-gh-yuwang

@sfc-gh-yuwang sfc-gh-yuwang commented Sep 11, 2025

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

    Fixes SNOW-2241913

  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
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

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

Comment thread src/snowflake/snowpark/_internal/data_source/datasource_reader.py Outdated
Comment thread tests/integ/datasource/test_mysql.py Outdated
Comment thread tests/integ/datasource/test_postgres.py Outdated
Comment thread CHANGELOG.md Outdated
- Hybrid execution mode is now enabled by default. Certain operations on smaller data will now automatically execute in native pandas in-memory. Use `from modin.config import AutoSwitchBackend; AutoSwitchBackend.disable()` to turn this off and force all execution to occur in Snowflake.
- Added a session parameter `pandas_hybrid_execution_enabled` to enable/disable hybrid execution as an alternative to using `AutoSwitchBackend`.
- Removed an unnecessary `SHOW OBJECTS` query issued from `read_snowflake` under certain conditions.
- Add non-retryable failure in `DataFrameReader.dbapi`(PuPr), such as syntax error in external data source SQL.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit:

  1. this should be moved to snowpark python api updates
  2. the description is a little confusing, you could describe it like improve dbapi not to retry on non-retryable error

Comment thread src/snowflake/snowpark/exceptions.py Outdated
pass


class SnowparkDataSourceNonRetryableException(SnowparkGeneralException):

@sfc-gh-aling sfc-gh-aling Sep 24, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this makes the exception class public api. is this class for internal usage only to differentiate from other error? if so we can make it private by _ SnowparkDataSourceNonRetryableException.

another way to is set a private memvar on SnowparkDataframeReaderException to differentiate retry from non-retry

the name sound general and more for internal usage, and if we want something for public customer facing exception, I personally prefer exception classes with concrete meanings which I think would take more time to design

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what about ingestion (copy into), if we have SnowparkSQLException, should we retry?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think non-retryable exception is for error that we know that it will not work even if we retry.
I think SnowparkSQLException is a very general failure that not only exception like SQL syntax error could trigger it.
For example, a udtf could fail with SnowparkSQLException because of python error that is retryable.

raise ValueError("fetch size cannot be smaller than 0")
except Exception as exc:
if self.driver.non_retryable_error_checker(exc):
raise _SnowparkDataSourceNonRetryableException(exc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

as per our discussion, we do not need the private class and can just raise the existing reader exception here

create_connection_oracledb,
table=ORACLEDB_TABLE_NAME,
predicates=["invalid syntax"],
).collect()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Curious about why some tests use .collect() while others don't, my impression is that dbapi() is not lazily evaluated?

@sfc-gh-yuwang sfc-gh-yuwang merged commit ea70c43 into main Sep 30, 2025
29 checks passed
@sfc-gh-yuwang sfc-gh-yuwang deleted the SNOW-2241913 branch September 30, 2025 17:56
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 30, 2025
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