Databricks
Databricks is a unified data analytics platform that provides a collaborative environment for data scientists, data engineers, and business analysts. It is built on top of Apache Spark, which makes it easy to scale and process big data workloads.
Bruin supports Databricks as a data platform.
Connection
In order to work with Databricks you can add as a configuration item to connections
in the .bruin.yml
file complying with the following schema:
yaml
connections:
databricks:
- name: "connection_name"
token: "your-databricks-token"
path: "your-databricks-endpoint-path"
host: "your-databricks-host"
port: "your-databricks-port"
catalog: "your-databricks-catalog"
schema: "your-databricks-schema"
Databricks Assets
databricks.sql
Runs a materialized Databricks asset or a Databricks SQL script. For detailed parameters, you can check Definition Schema page.
Example: Create a table using table materialization
bruinsql
/* @bruin
name: events.install
type: databricks.sql
materialization:
type: table
@bruin */
select user_id, ts, platform, country
from analytics.events
where event_name = "install"
Example: Run a script
bruinsql
/* @bruin
name: events.install
type: databricks.sql
@bruin */
create temp table first_installs as
select
user_id,
min(ts) as install_ts,
min_by(platform, ts) as platform,
min_by(country, ts) as country
from analytics.events
where event_name = "install"
group by 1;
create or replace table events.install
select
user_id,
i.install_ts,
i.platform,
i.country,
a.channel,
from first_installs as i
join marketing.attribution as a
using(user_id)