2

How can I access objects under INFORMATION_SCHEMA in a DB in Snowflake?

If I try to grant USAGE access to a PUBLIC or any role on INFORMATION_SCHEMA I get this error: SQL access control error: Insufficient privileges to operate on schema 'INFORMATION_SCHEMA'

I am trying to access objects under INFORMATION_SCHEMA from Power BI. Would be possible to do this..?

3 Answers 3

1

There are a lot of views and table functions in a databases's INFORMATION_SCHEMA. Some require elevated permissions, but if you just want basic access for a role all it needs is usage on the database:

use role ACCOUNTADMIN;
create or replace role NEWROLE;
grant usage on database TEST to NEWROLE;
grant role NEWROLE to user MYUSER;
use role NEWROLE;
select * from "TEST"."INFORMATION_SCHEMA"."COLUMNS";
Sign up to request clarification or add additional context in comments.

Comments

0

INFORMATION_SCHEMA is at the DB level, I believe so long as you have usage access at the DB level, you should be able to access INFORMATION_SCHEMA underneath it, as Greg's example has suggested.

But the result from INFORMATION_SCHEMA can be dependent on the user's access. For example, if the user does not have access to certain tables, then they won't appear in the results.

Comments

-1

TO allow a role to read from the information_schema and get results about a table 3 things have to happen:

  1. grant usage on the database to the role

  2. grant usage on the schema the table is in to the role.

  3. grant some access to the table to the role. Normally, this could be "SELECT" but that would give read access to all production tables. However, granting REFERENCES to the table will also work, I think. the main purpose of REFERENCES is to allow a role to set up a reference - a FK relationship to another table ( think referencing INVOICE_NUMBER in INVOICE_HEADER from INVOICE_DETAILS to be sure the parent table has the data) The REFERENCE does not allow the role to CRUD any of the data other than "background" reference. REFERENCE seems better for PRODUCTION data than SELECT.

    Any thoughts or caveats welcome

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.