Databricks Adapter
Generate Databricks SQL from your model.
What the adapter emits
- Identifiers in
`backticks`; bare column names in expressions are lowercased. - Grain truncation as
DATE_TRUNC('month', x); parts withYEAR(x),DAYOFYEAR(x),DAYOFWEEK(x),WEEKOFYEAR(x). - CTEs for the per-fact subqueries and a
FULL OUTER JOINwhen a query blends measures from two facts.
Configuration
databricks_lakehouse:
adapter: databricks
name: Databricks Lakehouse
tier: warm
host: workspace-id.cloud.databricks.com
warehouse: 1234abcd5678ef90
catalog: main
schema: default
# oauth_client_id / oauth_client_secret: never here; your application holds them
Connection fields
The server never connects to Databricks: it has no database driver in it, and the only keys the deployed model keeps are adapter, tier and the name. Your application runs the statement it gets back, with its own credentials.
zsql on this machine does connect, read-only, for zsql catalog, zsql sample and zsql run. It takes a personal_access_token, or client_id with oauth_client_secret for a service principal, against the workspace host and the SQL warehouse id; catalog names the Unity catalog whose information_schema it reads. Secrets go in .zsql or ZSQL_DS_<KEY>_<FIELD>, never in datasources.yml; zsql deploy strips oauth_client_id, oauth_client_secret, personal_access_token and password from the file if present. See Connecting to a warehouse.
Notes
- Expressions are Databricks SQL.
approx_count_distinct,percentile_approx,collect_listandtry_divideare fine inexpression.sql. - Unity Catalog names go in
physical_nameascatalog.schema.table, orschema.tablewhen your application’s session sets a default catalog.