Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep existing behaviour for session.read.<file_format>(<path>), tha…
Browse files Browse the repository at this point in the history
…t paths starting with `/` are an error.
sfc-gh-tvanderkooy committed Jan 27, 2025
1 parent 59a7d69 commit 3fb1be2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/snowflake/snowpark/_internal/utils.py
Original file line number Diff line number Diff line change
@@ -69,6 +69,8 @@
SNOWFLAKE_PATH_PREFIXES = [
STAGE_PREFIX,
SNOWURL_PREFIX,
]
SNOWFLAKE_PATH_PREFIXES_FOR_GET = SNOWFLAKE_PATH_PREFIXES + [
RELATIVE_PATH_PREFIX,
]

@@ -374,7 +376,7 @@ def normalize_path(path: str, is_local: bool) -> str:
a directory named "load data". Therefore, if `path` is already wrapped by single quotes,
we do nothing.
"""
prefixes = ["file://"] if is_local else SNOWFLAKE_PATH_PREFIXES
prefixes = ["file://"] if is_local else SNOWFLAKE_PATH_PREFIXES_FOR_GET
if is_single_quoted(path):
return path
if is_local and OPERATING_SYSTEM == "Windows":
@@ -410,7 +412,7 @@ def split_path(path: str) -> Tuple[str, str]:

def unwrap_stage_location_single_quote(name: str) -> str:
new_name = unwrap_single_quote(name)
if any(new_name.startswith(prefix) for prefix in SNOWFLAKE_PATH_PREFIXES):
if any(new_name.startswith(prefix) for prefix in SNOWFLAKE_PATH_PREFIXES_FOR_GET):
return new_name
return f"{STAGE_PREFIX}{new_name}"

0 comments on commit 3fb1be2

Please sign in to comment.