BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
samanvi
Obsidian | Level 7

HI Every one,

 

One of my sas code is connecting to snowflake and keep executing  for long time after 4 hrs the session is getting disconnected and sas job is getting failed with error

"ERROR:CLI PREPARE ERROR AUTH TOKEN EXPIRED, uSER MUST AUTH AGAIN"

 

Could you help me how to keep session active.

1 ACCEPTED SOLUTION

Accepted Solutions
SASJedi
Ammonite | Level 13

Is your program assigning the Snowflake LIBNAME early in the code, then doing a lot of other stuff that doesn't use Snowflake data? According to this Snowflake forum article, your error message indicates that your Snowflake session has gone more than 4 hours without activity. They Do mention that you could use the CLIENT_SESSION_KEEP_ALIVE option to extend the session timeout. The LIBNAME Statement for Snowflake documentation provides a CONOPTS statement option that can be used to specify additional Snowflake connection options like this one. 

 

Check out my Jedi SAS Tricks for SAS Users

View solution in original post

3 REPLIES 3
SASJedi
Ammonite | Level 13

Is your program assigning the Snowflake LIBNAME early in the code, then doing a lot of other stuff that doesn't use Snowflake data? According to this Snowflake forum article, your error message indicates that your Snowflake session has gone more than 4 hours without activity. They Do mention that you could use the CLIENT_SESSION_KEEP_ALIVE option to extend the session timeout. The LIBNAME Statement for Snowflake documentation provides a CONOPTS statement option that can be used to specify additional Snowflake connection options like this one. 

 

Check out my Jedi SAS Tricks for SAS Users
samanvi
Obsidian | Level 7

This helps.

Added the statement -> 

 CONOPTS ='client_session_keep_alive=True' in the  libname snowflake connection and issue is resolved.

 

SASKiwi
PROC Star

I suggest you discuss your issue with your Snowflake DBA to see if there are any timeout settings for database connections. If there is a hard setting in Snowflake then that's the only place it can be changed.

CFC_SAS_Communities_400x225.jpgCFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 4296 views
  • 2 likes
  • 3 in conversation