Snowflake user_name

Hi Team,
i am trying to build streamlit app by using snowpark,
Use_case: Need to check access for USER: user_name and respective role ex: SYSADMIN the the user can access the existing snowflake data through streamlit. else this should through error
i am not able find how to map user_name with role in snowflake through streamlit . could you please help on this.

Hi. Try running this query. This should solve the problem.

USE ROLE ACCOUNTADMIN;
GRANT READ SESSION ON ACCOUNT TO ROLE streamlit_owner_role;

Now if you run the query in Streamlit app which is in Snowflake. You will get the response.

SELECT CURRENT_USER();

ref: Additional Streamlit in Snowflake features | Snowflake Documentation