A GitHub-ready project that reproduces the Databricks SQL lab end‑to‑end using Unity Catalog: catalog & schema setup, managed Volume for CSVs, Bronze streaming tables, Silver materialized views, and example analytics queries.
sql/01_catalog_schema.sql— create catalog & schemasql/02_volume_and_copy.sql— create Volume, load CSVs viaCOPY INTOsql/03_bronze_streaming.sql— create BronzeSTREAMING TABLEs from Volume pathssql/04_silver_materialized_views.sql— create Silver materialized views (+ Gold agg example)sql/05_queries_examples.sql— alert/AI/BI-friendly queries and examplesdocs/setup.md— quick start (upload CSVs, run in order)docs/dashboards.md— optional AI/BI dashboard steps.github/workflows/sql-format.yml— basic SQL lint/format (placeholder)
- Prereqs: Unity Catalog enabled, a SQL Warehouse you can use.
- Create the target DB (catalog+schema) and Volume by running files in order from
sql/01_*thensql/02_*. - Upload CSVs to the Volume (UI → Catalog Explorer → your catalog → schema →
raw_airline_files→ Upload):airports/airports.csvflights/flights.csvlookupcodes/lookupcodes.csv
- Ingest tables with
COPY INTO(runsql/02_*). - Create Bronze streaming tables (run
sql/03_*). - Create Silver materialized views (+ Gold) (run
sql/04_*). - Run example queries (run
sql/05_*).
Replace the sample catalog
dbsql_samueland schemademoif you need different names.
All file reads use the required UC pattern:
/Volumes/<catalog>/<schema>/<volume>/<folder>/<file>
Example used here:
/Volumes/dbsql_samuel/demo/raw_airline_files/airports/airports.csv
- For reliability on teaching warehouses, we prefer
COPY INTOandread_files(...)overUSING CSV OPTIONS(path ...). - Materialized views cannot define column lists or constraints; PK/FK are shown on tables if needed.
- Some environments reset the current catalog/schema — fully‑qualify objects or precede blocks with
USE CATALOG/SCHEMA.
MIT