Aan de slag met Databricks SQL

Databricks-concepten

Kevin Barlow

Data Practitioner

SQL-compute vs. algemene compute

Clusters ontwerpen voor data science- of data engineering-workloads...

import pyspark.sql.functions as F

spark_df = (spark
            .read
            .table('user_table'))

spark_df = (spark_df
            .withColumn('score', 
                        F.flatten(...))
           )

is wezenlijk anders dan compute ontwerpen voor SQL-workloads

SELECT *
FROM user_table u
LEFT JOIN product_use p
    ON u.userId = p.userId
WHERE country = 'USA'
AND utilization >= 0.6
Databricks-concepten

SQL Warehouse

SQL Warehouse-UI

Databricks-concepten

SQL Warehouse

SQL Warehouse-instellingen

  1. Clustenaam
  2. Clustergrootte (S, M, L, etc.)
  3. Schaalgedrag

SQL Warehouse UI - Cluster Size

Databricks-concepten

SQL Warehouse

SQL Warehouse-instellingen

  1. Clustenaam
  2. Clustergrootte (S, M, L, etc.)
  3. Schaalgedrag
  4. Clustertype

SQL Warehouse UI - Cluster Type

Databricks-concepten

SQL Warehouse-types

Verschillende types, verschillende voordelen

Classic

  • Meest basis SQL-compute
  • In klantcloud

Pro

  • Meer features dan Classic
  • In klantcloud

Serverless

  • Nieuwste features
  • In Databricks-cloud
  • Meest kostenefficiënt
Databricks-concepten

SQL-editor

SQL-editor

Databricks-concepten

Veelgebruikte SQL-commando's

COPY INTO

  • Haal ruwe data op en zet in Delta
  • De Extract in ETL
COPY INTO my_table
FROM '/path/to/files'
FILEFORMAT = <format>
FORMAT_OPTIONS ('mergeSchema' = 'true')
COPY_OPTIONS ('mergeSchema' = 'true');

CREATE <entity> AS

  • Maak een Table of View
  • De Transform in ETL
CREATE TABLE events
  USING DELTA
  AS (
      SELECT *
    FROM raw_events
    WHERE ...
  )
Databricks-concepten

Laten we oefenen!

Databricks-concepten

Preparing Video For Download...