cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Mock user doesn't have the required privileges to access catalog `remorph` while running 'make test'

rai00
Visitor

Utility : Remorph (Databricks)

Issue  : 'User `me@example.com` doesn't have required privileges :: ``to access catalog `remorph`' while running 'make test' cmd

I am encountering an issue while running tests for Databricks Labs Remorph using 'make test' cmd. The error indicates that the mock user does not have the required privileges to access the catalog remorph, despite explicitly adding the user to the 'admins' group.

1. Relevant Code Snippet :

         @pytest.fixture

         def ws():

         w = create_autospec(WorkspaceClient)

         w.current_user.me.side_effect = lambda: iam.User(

         user_name="me@example.com", groups=[iam.ComplexValue(display="admins")],

         )

         w.config.return_value = {"warehouse_id" , "1234"}

         return w  

2. Troubleshooting Steps Taken:

  • Mocking a user using WorkspaceClient.
  • User has been added to the admins group.
  • Attempted to assign catalog-level permissions like catalog:read:remorph and few more,
    but the error still persists.

    Expected Behaviour : The mock user 'me@example.com'should have equivalent admin privileges to access the 'remorph' catalog and schema during tests.

    Requesting for a help on resolving the same. 

1 REPLY 1

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @rai00,

Ensure that the mock user me@example.com has the necessary privileges at both the catalog and schema levels. The user needs specific privileges such as USE_SCHEMA and CREATE_VOLUME

 

Use the WorkspaceClient to check the effective privileges for the user.

 

permissions = ws.grants.get_effective(SecurableType.SCHEMA, "remorph", principal="me@example.com")

user_privileges = [p.privilege for p in chain.from_iterable(privilege.privileges for privilege in permissions.privilege_assignments if privilege.privileges)]

print(user_privileges)

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group