Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snowflake UDF returns "Unknown user-defined function" For Existing UDF

I have a UDF that I can call within my snowflakecomputing.com console.

SELECT DECODE_UTF8('some string')

Works great, until I try to call it programmatically from a Python script. I receive this...

snowflake.connector.errors.ProgrammingError: 002141 (42601):
or:
Unknown user-defined function CS_QA.CS_ANALYTICS.DECODE_UTF8

I am even fully qualifying it (i.e., db.schema.function)

Can anyone suggest a fix? Thank you.

like image 727
JRomeo Avatar asked Sep 08 '25 08:09

JRomeo


1 Answers

Most likely the user(and role assigned) used to connect from Python does not have access to that UDF. This hypothesis could be validated by using INFORMATION_SCHEMA.FUNCTIONS:

The view only displays objects for which the current role for the session has been granted access privileges.

SELECT *
FROM CS_QA.INFORMATION_SCHEMA.FUNCTIONS;

Another possibility is that part of the fully-qualified name is case-sensitive and requires wrapping with "

SELECT "CS_QA"."CS_ANALYTICS".DECODE_UTF8('some string');
like image 200
Lukasz Szozda Avatar answered Sep 09 '25 23:09

Lukasz Szozda