October 22, 2024
Chicago 12, Melborne City, USA
SQL

How do I grant a role to CURRENT_USER in Snowflake?


I am creating a portable SQL script. The CURRENT_USER may vary but I want to always grant role X to them. I have tried the following which fail:

  • GRANT ROLE X to CURRENT_USER;
  • GRANT ROLE X to CURRENT_USER();

both with Syntax error: unexpected 'CURRENT_USER'. (line 1)

Is there a way to do this?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video