-
Notifications
You must be signed in to change notification settings - Fork 151
SNOW-2241913: non-retryable error handling #3770
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
Changes from 14 commits
eb90d6f
fd19348
ff5734a
08cb331
28439e8
38cc172
2289c94
e7023c7
355d596
083dce7
5bad371
d8e3d4a
4eb3816
f3ba610
947894c
dea1369
8ba8a4d
f969cd6
52bd157
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,10 @@ | |
|
|
||
| from snowflake.snowpark._internal.data_source.datasource_typing import Connection | ||
| from snowflake.snowpark._internal.data_source.drivers.base_driver import BaseDriver | ||
| from snowflake.snowpark.exceptions import SnowparkDataframeReaderException | ||
| from snowflake.snowpark.exceptions import ( | ||
| SnowparkDataframeReaderException, | ||
| _SnowparkDataSourceNonRetryableException, | ||
| ) | ||
| from snowflake.snowpark.types import StructType | ||
| from snowflake.connector.options import pandas as pd | ||
| import logging | ||
|
|
@@ -85,6 +88,11 @@ def read(self, partition: str) -> Iterator[List[Any]]: | |
| batch = [] | ||
| else: | ||
| raise ValueError("fetch size cannot be smaller than 0") | ||
| except Exception as exc: | ||
| if self.driver.non_retryable_error_checker(exc): | ||
| raise _SnowparkDataSourceNonRetryableException(exc) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| else: | ||
| raise | ||
| finally: | ||
| try: | ||
| cursor.close() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| ) | ||
| from snowflake.snowpark.types import StructType, StructField, StringType | ||
| from snowflake.snowpark.exceptions import ( | ||
| _SnowparkDataSourceNonRetryableException, | ||
| SnowparkDataframeReaderException, | ||
| SnowparkSQLException, | ||
| ) | ||
|
|
@@ -254,6 +255,18 @@ def test_unsupported_type(): | |
| assert schema == StructType([StructField("TEST_COL", StringType(), nullable=True)]) | ||
|
|
||
|
|
||
| def test_oracledb_non_retryable_error(session): | ||
| with pytest.raises( | ||
| _SnowparkDataSourceNonRetryableException, | ||
| match="ORA-00920: invalid relational operator", | ||
| ): | ||
| session.read.dbapi( | ||
| create_connection_oracledb, | ||
| table=ORACLEDB_TABLE_NAME, | ||
| predicates=["invalid syntax"], | ||
| ).collect() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious about why some tests use |
||
|
|
||
|
|
||
| def test_query_timeout_and_session_init(session): | ||
| statement = """ | ||
| BEGIN | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.