docs/en/sql-reference/sql-statements/account-management/EXECUTE_AS.md
Use the IMPERSONATE privilege with EXECUTE AS statements to switch the execution context of the current session to the impersonated user.
This command is supported from v2.4.
EXECUTE AS user WITH NO REVERT
user: The user must already exist.
Switch the execution context of the current session to the user test2.
EXECUTE AS test2 WITH NO REVERT;
After the switch succeeds, you can run the select current_user() command to obtain the current user.
select current_user();
+-----------------------------+
| CURRENT_USER() |
+-----------------------------+
| 'default_cluster:test2'@'%' |
+-----------------------------+