pyspark managed hive table grant not working - pyspark

I am using below code to save results of processing from dataframe to a hive table
df.write.mode("append").format("parquet").saveAsTable(tablename)
I am able to access the table using select sql externally, after the spark processing is completed using spark-submit
But another user is getting error "permission denied"
I have given the user permission using below grant statement
grant select on table schema1.tablename to user anotheruser;

Related

Is there any way to delete or hide Automated Materialized Views (AutoMV) tables from redshift users

I copied the tables from 1 Redshift Database to another Redshift Database through amazon redshift snapshots.
After successfully copying the tables from 1 DB to another DB there are some auto generated redshift tables "pg_automv.*" created.
I tried drop table pg_automv.auto_mv_******** command but it shows Error running query: permission denied for schema pg_automv result
Is there any way to delete or hide these tables from a specific users

Redshift Materialized View Not Refreshing (No Error)

I have a materialized view in Redshift that refreshes fine when I run refresh materialized view command, however the AWS Glue job is failing to refresh.
I'm not seeing any kind of error in the logs and reviewing the redshift query history shows it completing successfully. Additionally, the update time is the same so it does appear to be running correctly. However querying the view after glue updates does not show updated records, but does if I run the refresh.
I have ran the following permissions to grant the glue account access.
alter table reporting.my_view owner to glue;
alter schema reporting owner to glue;
grant all on schema reporting to glue;
grant all on all tables in schema reporting to glue;
alter default privileges in schema reporting grant all on tables to glue;
Try to use "commit;" before your main post actions query, for example:
"postactions": "commit; your_query"
REFRESH works for commited records only.

postgres user restrict schema changes

I need a postgres user who cannot alter tables, views, triggers etc. Only select & insert into tables, so I created new role and granted SELECT, INSERT, USE SCHEMA(something like that), SEQUENCE and even EXECUTE ON ALL FUNCTIONS privileges. But when I run function, I get following error: ERROR: permission denied for relation #table_name.

Minimum permission required to access Redshift External table

As per the AWS documentation,
To run a Redshift Spectrum query, you need the following permissions:
Usage permission on the schema
Permission to create temporary tables in the current database
I have an External database, schema and a table created in that schema.
I created a new Redshift user to which I granted 'usage' privileges on the external schema:
grant usage on external_schema to new_user;
But I did not provided 'temp' privileges on external_database to my new_user.
Also, there are no default privileges, as I checked PG_DEFAULT_ACL using master user and there are no rows in it.
Can someone let me know why I am able to query the external table?
In Amazon Redshift, Database and Schema are different concepts. User objects (Redshift and external) are created in Schema and TEMP objects are created in "temp" schemas and are available at database level.
In some cases, where join between Spectrum tables and Redshift tables is applied, Redshift needs to create temporary tables and that's why it is mentioned in documentation to avoid any failure/error for users.
Here is what documentation says:
Grants the privilege to create temporary tables in the specified database. To run Amazon Redshift Spectrum queries, the database user must have permission to create temporary tables in the database.
Note
By default, users are granted permission to create temporary tables by their automatic membership in the PUBLIC group. To remove the privilege for any users to create temporary tables, revoke the TEMP permission from the PUBLIC group. Then explicitly grant the permission to create temporary tables to specific users or groups of users.

Do not have select privilege for temporary table in db2 stored procedure

I am running a stored procedure in DB2 10.1 which creates a created global temporary table and it returns the following error message that seems to say that it cannot select from the temporary table that it has just created in the same stored procedure
"USER" does not have the required authorization or privilege to
perform operation "SELECT" on object "MYSCHEMA.MYTABLE"..
SQLCODE=-551, SQLSTATE=42501, DRIVER=4.16.53
I have not encountered this problem with the other stored procedures and they create temp tables in the same way. The user privileges are controlled by groups, but due to issues with the groups I have started to give privileges to the users directly.
I cannot grant select permissions to the temp table because its not yet created and not sure how to fix this situation.
Has anyone come across this problem before and if so how did you fix it?
Thanks for any help.