Get the email address or principal identifier of the user that's running
the query.
SESSION_USER
SESSION_USER()
Description
For first-party users, returns the email address of the user that's running the
query.
For third-party users, returns the
principal identifier
of the user that's running the query.
For more information about identities, see
Principals.
Return Data Type
STRING
Example
SELECTSESSION_USER()asuser;/*----------------------* | user | +----------------------+ | jdoe@example.com | *----------------------*/
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eGoogleSQL for BigQuery offers security functions, including one called \u003ccode\u003eSESSION_USER\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSESSION_USER\u003c/code\u003e function returns the email address for first-party users executing the query.\u003c/p\u003e\n"],["\u003cp\u003eFor third-party users, \u003ccode\u003eSESSION_USER\u003c/code\u003e provides the principal identifier of the user running the query.\u003c/p\u003e\n"],["\u003cp\u003eThe function \u003ccode\u003eSESSION_USER\u003c/code\u003e returns a value of the type string.\u003c/p\u003e\n"]]],[],null,[]]