Skip to content
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

SNOW-893210: NotImplementedError when using SnowflakeFile to read from External Staging in UDF #1006

Open
jianmiao4 opened this issue Aug 15, 2023 · 4 comments
Labels
bug Something isn't working triaged

Comments

@jianmiao4
Copy link

jianmiao4 commented Aug 15, 2023

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    3.8

  2. What operating system and processor architecture are you using?

"Linux-5.4.129-200.el7.x86_64-x86_64-with-glibc2.17"

  1. What are the component versions in the environment (pip freeze)?

  2. What did you do?

CREATE OR REPLACE FUNCTION "LOAD_JSON"(file_path string)
RETURNS variant
LANGUAGE PYTHON
RUNTIME_VERSION = '3.8'
PACKAGES = ('snowflake-snowpark-python')
HANDLER = 'process'
AS
$$
import platform
from snowflake.snowpark.files import SnowflakeFile
import json

def process(file_path):
with SnowflakeFile.open(file_path, 'r') as f:
return json.load(f)
$$;

select "LOAD_JSON"(BUILD_SCOPED_FILE_URL(<<external_blob>>, <<file_path>>));

  1. What did you expect to see?

Expecting to JSON returned in UDF, but received the following error when calling the UDF:

Traceback (most recent call last):
File "_udf_code.py", line 8, in process
File "/usr/lib/python_udf/fca69f3e27f8e37a6a12047c6ce59553c3e8fbbd8157e24384ef483acdf4ac81/lib/python3.8/json/init.py", line 293, in load
return loads(fp.read(),
File "/usr/lib/python_udf/fca69f3e27f8e37a6a12047c6ce59553c3e8fbbd8157e24384ef483acdf4ac81/lib/python3.8/site-packages/snowflake/snowpark/files.py", line 132, in read
raise NotImplementedError(_DEFER_IMPLEMENTATION_ERR_MSG)
NotImplementedError: SnowflakeFile currently only works in UDF and Stored Procedures. It doesn't work locally yet.
in function LOAD_JSON with handler process

It was working until this weekend.

@jianmiao4 jianmiao4 added bug Something isn't working needs triage Initial RCA is required labels Aug 15, 2023
@github-actions github-actions bot changed the title NotImplementedError when using SnowflakeFile to read from External Staging in UDF SNOW-893210: NotImplementedError when using SnowflakeFile to read from External Staging in UDF Aug 15, 2023
@sfc-gh-yixie
Copy link
Collaborator

@jianmiao4

This PuPr feature is temporarily disabled due to an issue (as a preventative measure) and will get re-enabled with a mitigation in the next few releases.

https://community.snowflake.com/s/article/Presence-of-non-breaking-space-nbsp-characters-produces-corrupted-results-in-Snowpark-Python-functions.

@sfc-gh-yixie sfc-gh-yixie added triaged and removed needs triage Initial RCA is required labels Aug 17, 2023
@jianmiao4
Copy link
Author

@sfc-gh-yixie

Hi Yijun, do you know when this feature will get re-enabled again?

@sfc-gh-bprakash
Copy link

@jianmiao4 - We are expecting to re-enable this in the next couple weeks. If you want to have your account enabled sooner, then you can file a support ticket https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowflake-Lodge

@jianmiao4
Copy link
Author

Perfect thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

3 participants