Skip to main content
Beta ProductSQL Proxy is currently in beta. Features and APIs may change.
SQL Proxy supports two authentication modes:
ModeHow it worksBest for
PassthroughUser credentials forwarded directly to DatabricksUsers with existing Databricks credentials
ManagedProxy stores Databricks credentials, users authenticate with proxy tokensCentralized credential management

Datafold Admin Account

Datafold requires an admin account to manage infrastructure on your behalf:
  • Spin up/down SQL warehouses
  • Log query metadata for routing optimization

Setup

Create a service principal or use an existing one with the following permissions:
ResourcePermissionPurpose
SQL WarehousesCAN MANAGEStart/stop warehouses, modify settings
Unity CatalogUSE CATALOG, USE SCHEMAAccess metadata for routing
datafold_sql_proxy schemaCREATE TABLE, INSERT, SELECTQuery logging and routing optimization
Configure the admin account via the Principals API.

Passthrough Authentication

With passthrough authentication, user credentials are forwarded directly to Databricks. Users authenticate with their own Databricks credentials.

PAT (Personal Access Token)

Use your existing Databricks PAT:
# dbt profiles.yml
my_project:
  outputs:
    prod:
      type: databricks
      host: sqlproxy.your-company.datafold.com
      http_path: /sql/1.0/warehouses/proxy
      token: "{{ env_var('DATABRICKS_TOKEN') }}"

M2M OAuth (Service Principal)

Use your existing Databricks service principal. This method requires tools that support OAuth token exchange (e.g., Databricks JDBC driver, direct API calls):
# Python example with databricks-sql-connector
from databricks import sql

connection = sql.connect(
    server_hostname="sqlproxy.your-company.datafold.com",
    http_path="/sql/1.0/warehouses/proxy",
    credentials_provider=lambda: {
        "Authorization": f"Bearer {get_oauth_token()}"  # Your M2M OAuth token
    }
)
The Python databricks-sql-connector used by dbt does not support M2M OAuth. To use a Databricks service principal with dbt, register the service principal via the Admin API and use a proxy token.

Managed Authentication

With managed authentication, the proxy stores Databricks credentials for registered principals. Users authenticate with proxy tokens instead of Databricks credentials.

Setup

  1. Create a principal via the Admin API with their Databricks credentials
  2. Generate a proxy token for the principal via the Tokens API
  3. Distribute the token to users or configure in CI/CD

Using Proxy Tokens

Proxy tokens use the format sqlp_pcp_... (for principals) or sqlp_pm_... (for proxy managers). Use them in place of Databricks PATs:
# dbt profiles.yml
my_project:
  outputs:
    prod:
      type: databricks
      host: sqlproxy.your-company.datafold.com
      http_path: /sql/1.0/warehouses/proxy
      token: "{{ env_var('PROXY_TOKEN') }}"  # Proxy token (sqlp_pcp_...)

Benefits

  • Centralized credential management - Databricks credentials stored securely in proxy
  • Token rotation - Revoke proxy tokens without changing Databricks credentials
  • Audit trail - Track which principals executed which queries
  • Simplified onboarding - Users don’t need individual Databricks credentials

Required Databricks Permissions

The Databricks credentials used (either your own with passthrough, or the principal’s with managed auth) need the same permissions they would need when connecting to Databricks directly.

SQL Warehouse Access

PermissionGrants
CAN USEExecute queries on the warehouse
If routing to multiple warehouses, users need CAN USE on each warehouse.

Jobs Compute Access

For @datafold:jobs_compute routing:
PermissionGrants
CAN MANAGE RUNExecute jobs
CAN MANAGECreate and edit jobs

Unity Catalog Access

Standard Unity Catalog privileges on catalogs, schemas, and tables:
  • USE CATALOG
  • USE SCHEMA
  • SELECT (for reading data)
  • MODIFY (for writing data)