Quickstart: Set up a user to run a query

Preview

This feature is in Public Preview. Contact your Databricks representative to request access.

This quickstart shows how to add a user, create a SQL endpoint, and configure access to datasets for the user. It is required for the SQL Analytics user quickstart.

Requirements

Step 1: Add a user and enable for SQL Analytics access

  1. Log in to your Databricks workspace as an admin.

  2. At the bottom of the sidebar, click the AppSwitcher Icon app switcher icon and select AppWorkspace

  3. At the top right of the Workspace UI Workspace Settings, click the Account Icon user account icon, and select Admin Console.

    Admin console
  4. On the Users tab, click Add User.

    Add user
  5. In the Email field, enter the user email address, for example, user@example.com.

  6. Click Send invite.

  7. In the row containing the email address, select the SQL Analytics access checkbox.

    Endpoints
  8. Click Confirm.

Step 2: Create and start a SQL endpoint

  1. At the bottom of the sidebar, select AppSwitcher Icon > AppSQLAnalytics

  2. Click the Endpoints Icon icon in the sidebar.

  3. Click + New SQL Endpoint.

    Create endpoint
  4. In the Name field, enter QS Endpoint.

  5. Toggle the Auto Stop setting to On.

  6. Select More Options.

  7. In the Permissions tab, click the Down Arrow  Icon icon. Select the All Users principal and the Can Use permission.

  8. Click Add.

    Quickstart endpoint
  9. Click Create.

  10. In the Endpoints list, type QS in the filter box.

    Endpoints

    The QS Endpoint should display with State Starting Starting.

    Wait until the State is Running Running.

Step 3: Configure access to the default database

  1. Click the Queries Icon icon in the sidebar.

  2. Click + New Query. The query editor displays.

  3. Select the QS Endpoint endpoint.

  4. Enable the user you created in Step 1 to access the default database used in the user quickstart. Enter the following queries one by one:

    REVOKE ALL PRIVILEGES ON DATABASE default FROM `user@example.com`;
    
    GRANT USAGE ON DATABASE default TO `user@example.com`;
    
    GRANT SELECT ON DATABASE default TO `user@example.com`;
    
    GRANT READ_METADATA on DATABASE default TO `user@example.com`;
    
    SHOW GRANT `user@example.com` ON DATABASE default;
    

    After each query, press Ctrl/Cmd + Enter or click the Execute button. After the last query, it should display:

    +------------------+---------------+------------+-----------+
    | principal        | ActionType    | ObjectType | ObjectKey |
    +------------------+---------------+------------+-----------+
    | user@example.com | READ_METADATA | DATABASE   | default   |
    +------------------+---------------+------------+-----------+
    | user@example.com | SELECT        | DATABASE   | default   |
    +------------------+---------------+------------+-----------+
    | user@example.com | USAGE         | DATABASE   | default   |
    +------------------+---------------+------------+-----------+