Javier Lopez Tomas
Javier Lopez Tomas

Reputation: 2342

Command 'describe table' not authorized

I want to run the statement DESCRIBE TABLE dwh.ods.users with the role PUBLIC. I have already grant privileges to role public with:

grant all privileges on schema ods to public;

However, when I try to run the query, I get the following error: SQL compilation error:

Table 'DWH.ODS.USERS' does not exist or not authorized.

With the role USERADMIN it works. How could I solve it? Thanks

Upvotes: 1

Views: 240

Answers (2)

Gokhan Atil
Gokhan Atil

Reputation: 10039

Please try to grant SELECT on table, USAGE on schema and database:

grant usage on database DWH to public;
grant usage on schema DWH.ODS to public;
grant select on table DWH.ODS.USERS to public;

Upvotes: 0

Marcel
Marcel

Reputation: 2612

You also have to grant USAGE on the database. Granting all privileges on the schema doesn't mean granting privileges for the database.

GRANT USAGE ON DATABASE <database> TO ROLE <role>;

In your case:

GRANT USAGE ON DATABASE dwh TO ROLE public;

You can find more info about the USAGE-right here: https://docs.snowflake.com/en/user-guide/security-access-control-privileges.html

Upvotes: 2

Related Questions