BookmarkSubscribeRSS Feed
dstratm
Calcite | Level 5

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;

3 REPLIES 3
Tom
Super User Tom
Super User

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?

dstratm
Calcite | Level 5

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

dstratm_1-1657118796965.png

 

 

SASKiwi
PROC Star

Please post the complete SAS log of your program, including the error. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1056 views
  • 0 likes
  • 3 in conversation