Skip to content

Commit f263505

Browse files
review feedback
1 parent e6fab9d commit f263505

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/snowflake/snowpark/catalog.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from ctypes import ArgumentError
66
import re
7-
from typing import List, Optional, Union
7+
from typing import List, Optional, Union, TYPE_CHECKING
88

99
from snowflake.snowpark._internal.analyzer.analyzer_utils import unquote_if_quoted
10-
from snowflake.snowpark.exceptions import SnowparkSQLException
10+
from snowflake.snowpark.exceptions import SnowparkSQLException, NotFoundError
1111

1212
try:
1313
from snowflake.core.database import Database # type: ignore
@@ -23,25 +23,15 @@
2323
"Missing optional dependency: 'snowflake.core'."
2424
) from e # pragma: no cover
2525

26-
27-
from snowflake.connector.cursor import DictCursor
28-
from snowflake.snowpark.session import Session
2926
from snowflake.snowpark._internal.type_utils import (
3027
convert_sp_to_sf_type,
3128
type_string_to_type_object,
3229
)
3330
from snowflake.snowpark.functions import lit, parse_json
3431
from snowflake.snowpark.types import DataType
3532

36-
37-
class NotFoundError(Exception):
38-
"""Raised when we encounter an object is not found."""
39-
40-
def __init__(
41-
self,
42-
*args,
43-
) -> None:
44-
super().__init__(*args)
33+
if TYPE_CHECKING:
34+
from snowflake.snowpark.session import Session
4535

4636

4737
class Catalog:
@@ -50,9 +40,8 @@ class Catalog:
5040
views, functions, etc.
5141
"""
5242

53-
def __init__(self, session: Session) -> None: # type: ignore
43+
def __init__(self, session: "Session") -> None: # type: ignore
5444
self._session = session
55-
self._cursor = session._conn._conn.cursor(DictCursor)
5645
self._python_regex_udf = None
5746

5847
def _parse_database(

src/snowflake/snowpark/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,9 @@ class SnowparkInvalidObjectNameException(SnowparkGeneralException):
283283
"""
284284

285285
pass
286+
287+
288+
class NotFoundError(SnowparkClientException):
289+
"""Raised when we encounter an object is not found."""
290+
291+
pass

0 commit comments

Comments
 (0)