I created a simple view over an external table on Redshift Spectrum:
CREATE VIEW test_view AS (
SELECT *
FROM my_external_schema.my_table
WHERE my_field='x'
) WITH NO SCHEMA BINDING;
Reading the documentation, I see that is not possible to give access to view unless I give access to the underlying schema and table. So if I do the following statement:
GRANT SELECT ON test_view to my_user;
and I try to see data in the view, as expected I got the error:
Permission Denied on schema my_external_schema
To resolve this I could do GRANT USAGE ON SCHEMA my_external_schema TO my_user
but this will give SELECT on all tables inside that schema and is what that I'm trying to avoid.
There is a workaround to avoid this?
With normal Redshift Tables, grant usage on the schema is good enough, because the permission doesn't grant select on the underlying tables, is there something similar with Spectrum?
I cannot use Materialized View because the dataset is too large.