Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions snowflake/ml/model/_client/sql/model_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,21 @@ def get_file(
scheme="snow", netloc="model", path=stage_location, params="", query="", fragment=""
).geturl()
local_location = target_path.resolve().as_posix()
local_location_url = f"file://{local_location}"

if snowpark_utils.is_in_stored_procedure(): # type: ignore[no-untyped-call]
options = {"parallel": 10}
cursor = self._session._conn._cursor
cursor._download(stage_location_url, str(target_path), options)
cursor.fetchall()
else:
query_result_checker.SqlResultValidator(
self._session,
f"GET {_normalize_url_for_sql(stage_location_url)} {_normalize_url_for_sql(local_location_url)}",
statement_params=statement_params,
).has_dimensions(expected_rows=1).validate()
get_results = self._session.file.get(
stage_location_url, local_location, statement_params=statement_params
)
if len(get_results) != 1:
raise ValueError(
f"Expected to download exactly one file from {stage_location_url}, "
f"but got {len(get_results)}."
)
return target_path / file_path.name

def show_functions(
Expand Down