Skip to main content

CURRENT_TENANT_ID

Introduced or updated: v1.2.949

Returns the tenant ID of the current session as a VARCHAR value.

Use this function to get the tenant IDs for Data Sharing. A tenant ID is not a user name. To get the user name, use CURRENT_USER().

Syntax​

CURRENT_TENANT_ID()

Examples​

SELECT CURRENT_TENANT_ID();

In a session of the tenant provider_acct, the result is provider_acct.

If the ID contains uppercase letters or special characters, put the ID in backticks when you use it in a Share statement:

ALTER SHARE sales_share ADD ACCOUNTS = `consumer-tenant`;
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today