I’m using the below code to connect to Snowflake via SAS Fusion without error. However, there’s a function on the database that is needed but SAS is producing an error. When connecting to Snowflake via the web, this function works. Are there any suggestions?
Function:
OCDP_SECURITY.DPAAS_DETOKEN_NAME(FIRST_NAME) AS FIRST_NAME
Error:
ERROR: CLI prepare error: SQL compilation error: Unknown user-defined function OCDP_SECURITY.DPAAS_DETOKEN_NAME
SQL statement: SELECT OCDP_SECURITY.DPAAS_DETOKEN_NAME(FIRST_NAME) AS FIRST_NAME FROM OCDP_PRD_CDCM_DB.CDCM.PATIENT.
%LET SERVER= xxxx.com;
%LET UID= xxxxx;
%LET PRIV_KEY_FILE_UNENCR= /hpsasocd/idpwd/&sysuserid./rsa_key.prv;
LIBNAME SNOW_PT ODBC COMPLETE="
DRIVER={/usr/lib64/snowflake/odbc/lib/libSnowflake.so};
AUTHENTICATOR= SNOWFLAKE_JWT;
SERVER= &SERVER;
UID= &UID;
PRIV_KEY_FILE= &PRIV_KEY_FILE_UNENCR;
PRIV_KEY_FILE_PWD=;
Warehouse= OCDP_PRD_QUERY_WH;
Role=AR_PRD_ROLE;
";
PROC SQL;
CONNECT USING SNOW_PT AS SF;
CREATE TABLE TEST_PASSTHRU AS SELECT *
FROM CONNECTION TO SF
(SELECT *
FROM OCDP_PRD_CDCM_DB.CDCM.TENANT
);
QUIT;
How are you calling that function?
Is it being called for you when you try to run that last query?
Is that query pulling from a view that is calling the function?
Does SNOWFLAKE have some type of "search path" for UDF? Are you sure you have configured your Session properly to find it? Does the snowflake account you are connecting with have permission to use it?
The function is being called when running the below query. When submitted to Snowflake via web, there's no issues. If I run the same query as pass-through via SAS, I get error.
select ocdp_security.dpaas_detoken_name(FIRST_NAME)
from cdcm.patient (TABLE)
Under the Information_Schema view is where the function resides
Please post the complete SAS log of your program, including the error.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.