Skip to content

Setting up a Databricks Connection

Databricks is a data and AI platform where many organizations stage their finance, operations, and planning data in a lakehouse governed by Unity Catalog. Nexadata integrates directly with Databricks in both directions: you can read tables, views, and query results into Nexadata datasets, transform and harmonize them, and write the results back to a Databricks table.

Here are the key features:

  • Two ways to read: Read the tables and views your admin has placed in an OpenSharing share, or run your own SQL statement on a SQL warehouse.

  • Write-back to Databricks tables: Send Workflow outputs to a Databricks table with Append or Upsert, with every column written at an explicit type so financial amounts tie to the cent.

  • Service principal authentication: Connect with OAuth machine-to-machine credentials for a Databricks service principal, not a personal access token.

  • Secure credential storage: Secrets, tokens, and profiles are encrypted and stored server-side.

This article covers the setup in three parts. Parts 1 and 2 are usually completed with your Databricks admin. Part 3 takes place in Nexadata.


A Databricks connection uses one of three authentication types. Which one you need depends on what you want to do.

Authentication typeRead from a shareRead with a SQL statementWrite outputs backWho Nexadata acts as
Service PrincipalYesYesA service principal you create
App Connection (User Sign-In)YesYesThe Databricks user who signs in
OpenSharing ProfileYesA sharing recipient, read-only

Service Principal is the default and the recommended choice for SQL reads and write-back. A service principal is an account in Databricks made for an application rather than a person. Nobody signs in with it; Nexadata uses its Client ID and Client Secret, much like a username and password reserved for one system. It can do only what your admin grants it, so its access is easy to review and revoke, and it keeps working when people change roles or leave.

App Connection (User Sign-In) connects Nexadata as a real Databricks user. An app connection is an entry that a Databricks account admin creates to tell Databricks that Nexadata is allowed to ask users for access. When you click Connect to Databricks, you sign in to Databricks yourself and approve the request, the same way you might allow an app to use your Google account. Nexadata then acts as you, with your privileges, and every action is recorded under your name. Choose it if your organization prefers that integrations act on behalf of named users, or does not allow service principals for this purpose.

OpenSharing Profile (OpenSharing is Databricks’ new name for Delta Sharing) is the easiest for an admin to approve. Your admin places selected tables in a share and gives Nexadata a credential file that can read only that share. Nexadata can read only what is placed in the share, and the share cannot be written to.

Service Principal and App Connection (User Sign-In) both use OAuth, the standard way for one application to get access to another without sharing a person’s password. They use two different OAuth flows, and the difference is whether a person signs in:

Service PrincipalApp Connection (User Sign-In)
OAuth flowMachine-to-machine (M2M)User-to-machine (U2M)
How Nexadata gets accessNexadata sends the Client ID and Client Secret to Databricks and receives a short-lived token. Nobody signs in.You sign in to Databricks and approve access. Databricks then gives Nexadata tokens to act on your behalf.
Whose identity is usedThe service principal’sYours
Scopessql, filessql, files, offline_access

The offline_access scope lets Nexadata renew its access without asking you to sign in again. A service principal does not need it, because Nexadata can request a new token with the Client Secret at any time.


Complete the section that matches the authentication type you chose. Most of these steps require a Databricks workspace admin, or the owner of the catalogs and schemas involved.

  1. In Databricks, open Settings → Identity and access → Service principals and create a service principal for Nexadata, for example nexadata-connector. Open it and make sure Databricks SQL access is checked under Entitlements. It is the only entitlement Nexadata needs; leave the others at your workspace defaults, and leave Admin access unchecked. The service principal’s Application Id is the Client ID you will enter in Nexadata.

    The nexadata-connector service principal details, showing its Application Id, groups, Active status, and entitlements with Databricks SQL access, the only one Nexadata needs, highlighted.

  2. On the Secrets tab, click Generate secret, set its lifetime (1 to 730 days), and include the sql and files scopes. files is needed to write outputs back. Copy the Secret and Client ID before you click Done; the secret is shown only once.

    The Generate secret dialog with the Secret and Client ID fields, a warning that the secret will not be shown again, and the scopes sql and files.

  3. Grant the service principal Can use on each SQL warehouse Nexadata should run statements on. Open SQL Warehouses, click the warehouse name, then click Permissions.

    The Serverless Starter Warehouse overview page, with SQL Warehouses highlighted in the sidebar and the Permissions button highlighted at the top right.

    Select the service principal, choose Can use, and click Add.

    The Manage permissions dialog with nexadata-connector selected, the Can use permission highlighted, and the Add button.

    The service principal then appears in the warehouse’s permission list with Can use.

    The warehouse's Manage permissions list with nexadata-connector highlighted and set to Can use.

  4. In Catalog Explorer, grant the service principal the Unity Catalog privileges in Unity Catalog Privileges below.

App connections are created in the Databricks account console, which manages your whole Databricks account rather than one workspace. These steps require a Databricks account admin.

  1. In your Databricks workspace, click the workspace name at the top right, then click Manage account. The account console opens.

    The Databricks workspace home page with the workspace menu open at the top right, and both the workspace name and Manage account highlighted.

  2. In the account console, open Settings → App connections, select Custom apps, and click Add connection on the right.

    The account console Settings page with Settings highlighted in the sidebar, the App connections tab and Custom apps highlighted, and the Add connection button highlighted on the right.

  3. Fill in the connection:

    • Application Name: A name for Nexadata, for example nexadata.

    • Redirect URLs: Enter the Nexadata callback URL exactly as shown:

      https://app.nexadata.com/databricks/oauth/callback

      If the URL does not match exactly, Databricks rejects the sign-in and the connection cannot be authorized. Copy the URL above rather than typing it.

    • Access scopes: Use Add scope to add files, sql, and offline_access. The offline_access scope lets Nexadata refresh its access without asking you to sign in again.

    • Generate a client secret: Leave this checked. This setting cannot be changed after the connection is created.

    • Enable single-use refresh tokens (refresh token rotation): Check this. Databricks then issues a new refresh token each time Nexadata refreshes its access, and Nexadata saves it, so a connection that is in regular use stays signed in. Checking it adds a Max session TTL field.

    Leave the three time limits at their defaults. Nexadata renews its access automatically within them:

    • Access token TTL (60 minutes): How long each access token lasts. Nexadata gets a new one as needed.

    • Refresh token TTL (10,080 minutes, or 7 days): How long a connection can go unused. If nothing in Nexadata uses the connection for 7 days, the person must sign in again.

    • Max session TTL (129,600 minutes, or 90 days): The longest a sign-in can last, however often the connection is used. After 90 days, the person must sign in again.

    The Add connection form with the application name nexadata-docs, and the redirect URL, the files, sql, and offline_access scopes, Generate a client secret, and Enable single-use refresh tokens highlighted.

  4. Click Add. In the Connection created dialog, copy the Client ID and Client Secret before you click Done; the secret is shown only once. The dialog also shows when the client secret expires. Note the date, since the connection must be given a new secret before then.

    The Connection created dialog with the Client ID and Client Secret blurred, a warning to copy the secret now, and the secret's expiration date.

  5. Make sure each person who will sign in has Can use on the SQL warehouse, granted as in Option A, step 3, and the Unity Catalog privileges below. Grant them to the person, or to a group they belong to, instead of the service principal.

Option C: Create a Share and a Recipient for OpenSharing

Section titled “Option C: Create a Share and a Recipient for OpenSharing”

Before you start, OpenSharing with recipients outside your organization must be turned on for your Databricks metastore. This is a one-time setting that requires a Databricks account admin. If it is off, the Share data page shows the warning “External sharing is currently disabled in metastore configuration.”

To turn it on, open the account console (click the workspace name at the top right, then Manage account, as in Option B). Click Catalog, then click your metastore. In the Admin & Sharing section, click the pencil icon, check Allow OpenSharing with parties outside your organization, set the Recipient token lifetime according to your security policy, and save. The credential file Nexadata uses stops working when its token reaches this lifetime.

The metastore Configuration page in the account console, with Catalog highlighted in the sidebar and Allow OpenSharing with parties outside your organization checked and highlighted in the Admin & Sharing section.

Then create the share and the recipient in your workspace:

  1. In Databricks, click Catalog in the sidebar. At the top of the catalog pane, click the gear icon, then click OpenSharing under Share.

    The Catalog pane with Catalog highlighted in the sidebar, the gear icon menu open, and OpenSharing highlighted under Share.

  2. On the Shared by me tab, click Share data. Enter a Share name, for example nexadata_share, and click Save and continue.

  3. On Add data assets, expand the catalog and schema, and check each table or view Nexadata should read. You need SELECT on a table to add it to a share, which you already have if you own the table.

    If you check every table in a schema, Databricks asks whether to share the whole schema instead, which would also share any table added to it later. Click Select all to share only the tables you checked.

    The Share schema dialog asking whether to share the whole actuals schema instead, with the Select all button highlighted.

    Each table you checked appears on the right by its full name. Leave History at its default and click Save and continue. On Add notebooks, click Save and continue without adding any.

    The Add data assets step with beverage_sales checked under finance and actuals, finance.actuals.beverage_sales listed on the right, and Save and continue highlighted.

  4. On Add recipients, create a recipient for Nexadata. In Create a new recipient, change the following, since the defaults do not fit Nexadata:

    • Select Share manually, not Share using email. Nexadata takes the credential file directly, so no invitation is needed.

    • Enter a Recipient name, for example nexadata.

    • Under Recipient type, select Open, not Databricks. Nexadata is not a Databricks workspace.

    • Under How will the recipient be authenticated?, select Token. Nexadata connects with the token in the credential file.

    • Leave Token lifetime blank to use the Recipient token lifetime set on the metastore, or enter a shorter one.

    The Create a new recipient form with Share manually, the Open recipient type, Token authentication, and Create and add recipient highlighted, and the recipient name nexadata.

    Click Create and add recipient. The recipient is created, given access to the share, and listed with the authentication type TOKEN.

  5. Click the copy icon next to TOKEN to copy the recipient’s activation link, then click Share data to finish. Clicking Share data is what saves the share and gives the recipient access to it; if you close the wizard before this, neither is saved.

    The Add recipients step with nexadata listed as a recipient, and the copy icon next to TOKEN highlighted and showing Copied.

  6. Confirm the share is saved. Open Shared by me and click your share. The Overview tab lists each table with a green status check, and the Recipients tab lists the Nexadata recipient.

    The nexadata_share Overview tab listing actuals.beverage_sales with a green status check.

    If the recipient is missing, open Recipients, click the recipient, click Grant share, and choose your share. Nexadata can verify an OpenSharing connection only when the recipient has access to at least one share.

  7. Paste the activation link into your browser. On the page that opens, click Download credential file. The file is usually named config.share. It holds everything Nexadata needs to read the share: the share’s address and the access token. You paste its contents into Nexadata when you create the connection.

    The OpenSharing activation page with the Download credential file button highlighted and a warning that the file can be downloaded only once.

Unity Catalog is how Databricks organizes data and controls who can access it. It arranges data in three levels:

  • A catalog is the top-level container, often one per business area or environment, for example finance.

  • A schema sits inside a catalog and groups related data, for example finance.actuals for source data and finance.planning for results.

  • Tables, views, and volumes sit inside a schema. Tables and views hold rows of data. A volume holds files, and Nexadata uses one to stage data before loading it into a table.

Access is granted with privileges, and a privilege granted at one level applies to everything beneath it. A privilege on a catalog covers every schema in it, and a privilege on a schema covers every table and volume in it. To reach a table, a user or service principal needs access at every level: USE CATALOG on the catalog, USE SCHEMA on the schema, and a privilege such as SELECT on the table or its schema.

This is why the steps below grant most privileges on a schema rather than on the whole catalog: Nexadata gets exactly the access it needs where it needs it, and nothing elsewhere in the catalog.

For Service Principal and App Connection, grant the following to the service principal, or to the user who signs in. These are the minimum privileges for Nexadata to both read from and write to a schema:

Grant onPrivileges
The catalogUSE CATALOG
The schemaUSE SCHEMA, SELECT, MODIFY, READ VOLUME, WRITE VOLUME, CREATE TABLE, CREATE VOLUME

Privileges granted on a schema apply to every table, view, and volume in it. Your Databricks admin can narrow them to fit your setup: for read-only access, USE SCHEMA and SELECT are enough, and access can be limited to specific tables instead of the whole schema. If Nexadata has a catalog of its own, the admin can instead grant all of these privileges on the catalog, and they then apply to every schema in it, including schemas added later.

To grant the schema privileges in Databricks:

  1. In Catalog, expand the catalog and click the schema Nexadata will use.

  2. Open the Permissions tab and click Grant.

    Catalog Explorer with the planning schema of the finance catalog selected, its Permissions tab open, and an arrow pointing to the Grant button.

  3. Under Principals, select the service principal. Check MODIFY, WRITE VOLUME, CREATE TABLE, and CREATE VOLUME; Databricks includes USE SCHEMA, SELECT, and READ VOLUME automatically, since the others depend on them. Click Confirm.

    The Grant on finance.planning dialog with nexadata-connector as the principal, MODIFY, WRITE VOLUME, CREATE TABLE, and CREATE VOLUME checked, and USE SCHEMA, SELECT, and READ VOLUME included automatically.

Grant USE CATALOG the same way, from the catalog’s own Permissions tab.


  1. From the Nexadata home screen, click the Create a Connection tile, or go to Setup → Connections and click Create Connection in the upper-right corner.

  2. In the Create New Connection form:

    • Enter a unique Name for your Databricks connection.

    • Select Databricks as the Connection Type.

  3. Under Authentication Type, select Service Principal, App Connection (User Sign-In), or OpenSharing Profile.

For Service Principal, enter the details from Option A:

  • Base URL: The URL of your Databricks workspace, for example https://dbc-a1b2c3d4-e5f6.cloud.databricks.com.

  • Client ID: The application ID of the service principal.

  • Client Secret: The OAuth secret you generated for the service principal.

For App Connection (User Sign-In), enter the details from Option B:

  • Base URL: The URL of your Databricks workspace.

  • Client ID: The client ID of the App connection.

  • Client Secret: Only required if the App connection is a confidential client.

Then click Connect to Databricks and sign in to Databricks in the tab that opens. Databricks shows the Permission Requested page, which lists what Nexadata is asking for: Allow longer-running access (the offline_access scope), Databricks SQL (sql), and File Management (files). Click Authorize.

The Databricks Permission Requested page for the Nexadata app connection, listing Allow longer-running access, Databricks SQL, and File Management, with the Authorize button.

The tab then shows a success message. Close it and return to Nexadata. The Access Token and Refresh Token fields are now filled in. Nexadata stores both tokens encrypted and renews the access token automatically.

A browser tab at the Nexadata Databricks callback URL showing SUCCESS! You may now close this window and navigate back to Nexadata.

For OpenSharing Profile, open the config.share file in a text editor, copy its entire contents, and paste them into OpenSharing Profile. Nexadata checks that the profile is valid and shows an error if it cannot be parsed.

  1. Click Verify Credentials. Nexadata connects to Databricks with the credentials you entered: it requests an access token for a service principal or an App connection, and lists the available shares for an OpenSharing profile.

  2. When verification succeeds, a green shield with a check mark appears next to Submit. For a Service Principal connection, the verified form looks like this:

    A Databricks connection using Service Principal, with the Base URL and Client ID blurred, the Client Secret masked, and the green shield next to Submit showing that verification succeeded.

    For an App Connection, the form also shows the Access Token and Refresh Token filled in by signing in.

    A Databricks connection using App Connection, with the Access Token and Refresh Token filled in and masked, the Base URL and Client ID blurred, and the green shield next to Submit showing that verification succeeded.

    For an OpenSharing Profile connection, the form shows only the pasted profile.

    A Databricks connection using OpenSharing Profile, with the pasted profile blurred and the green shield next to Submit showing that verification succeeded.

  3. Click Submit to save the connection.


  • Verification fails for a service principal? Check that the Base URL is your workspace URL and that the Client Secret has not expired. Generate a new secret on the service principal if it has.

  • Lost the config.share file? The activation link works only once. Ask your Databricks admin to rotate the recipient’s token, which issues a new activation link.

  • No SQL warehouses to choose from later? Grant the service principal, or the signed-in user, Can use on the warehouse. Workspace entitlements alone are not enough.

Next: Learn how to use the Databricks connection