Sub topic 2
What Databricks provides
Prerequisites
This chapter assumes you know basic SQL, can read short Python scripts, and understand cloud object storage and virtual machines. It also assumes you know how a data lake differs from a data warehouse. The previous chapter covered the lakehouse idea. This chapter lists what the Databricks platform provides and how the parts relate.
The working model
Databricks is a managed platform for data engineering, analytics, and machine learning. It runs on AWS, Azure, or Google Cloud. It does not replace your cloud storage. Your data stays in object storage that your organization owns, and Databricks supplies the layers around it:
- Compute that reads and writes the data.
- A table format that makes files behave like reliable tables.
- A catalog that names the tables and controls access to them.
- Tools for writing code, running queries, scheduling work, and building models.
A useful mental model is a stack. Storage is at the bottom and the user-facing tools are at the top. Each layer depends only on the one beneath it.
The main building blocks
The table lists the pieces you will meet in this tutorial. Each one gets its own chapter later.
| Building block | What it does | Where it appears later |
|---|---|---|
| Workspace | The web environment where you organize notebooks, queries, jobs, and other objects | Workspace chapters |
| Compute | Clusters, SQL warehouses, and serverless options that run your code | Compute chapter |
| Delta Lake | An open table format that adds transactions and versioned history to files | Delta Lake chapter |
| Unity Catalog | Central naming, permissions, and auditing for data and AI assets | Unity Catalog and governance chapters |
| Databricks SQL | A SQL-first interface for analysts, backed by SQL warehouses | SQL chapter |
| Jobs | Scheduled and triggered runs of notebooks, scripts, and pipelines | Jobs chapter |
| AI and ML tools | Experiment tracking, model serving, and related features | AI and ML chapter |
Open formats and open source
Databricks was founded by the original creators of Apache Spark. Several core pieces are open source or built on open standards:
- Spark is the distributed processing engine.
- Delta Lake is the table format. Its files are Parquet data files plus a transaction log.
- MLflow is a tool for tracking and deploying machine learning models.
Because data sits in open formats in your own storage, other engines can read it too. You are not locked into a proprietary storage layer. The managed parts are the compute, the workspace, and the governance features.
One platform, several roles
People with different jobs use the same platform and the same tables:
- Data engineers build pipelines that ingest and clean data, usually in notebooks or pipeline definitions run as jobs.
- Analysts write SQL in the SQL editor, build dashboards, and run queries on SQL warehouses.
- Data scientists explore data in notebooks and train models.
- Administrators manage users, compute policies, and permissions.
Because everyone reads the same governed tables, a pipeline's output is immediately available to analysts. No export or copy to a separate warehouse is needed. This is the practical payoff of the lakehouse design.
The same table from SQL and Python
The following example shows that the platform has one data layer with several interfaces. It assumes the main.tutorial.orders table from the SQL example in this tutorial exists and that you have permission to read it. Run it in a notebook attached to compute.
# Interface 1: the Python DataFrame API
df = spark.table("main.tutorial.orders")
print(df.count())
# Interface 2: SQL issued from Python
result = spark.sql("""
SELECT customer_id, SUM(amount) AS total_amount
FROM main.tutorial.orders
GROUP BY customer_id
""")
result.show()Both calls reach the same Delta table through the same three-level name, catalog.schema.table. The SQL editor in Databricks SQL would run the same query text against a SQL warehouse. Only the compute and the interface differ.
What Databricks does not do
Knowing the limits helps you avoid wrong assumptions:
- It is not where your data "lives" in a proprietary sense. Table data is stored as files in cloud storage. Deleting a workspace does not by itself explain what happens to that data. What happens depends on whether the table is managed or external, which a later chapter covers.
- It is not only Spark. Spark is the engine for many workloads, but SQL warehouses, governance, jobs, and AI features are separate parts of the platform.
- It is not a transactional application database. It is built for analytical and batch or streaming workloads, not for high-rate single-row updates behind a web application.
- It does not remove the need for design. You still decide how to organize data, who gets access, and which compute to use.
Common mistakes
- Confusing the account with the workspace. An account is the top-level organizational entity. It can contain several workspaces. Users and Unity Catalog metadata are managed at the account level, while notebooks and compute belong to a workspace. If you cannot find something, check which workspace you are in.
- Expecting code to run without compute. A notebook is only a document until you attach it to compute. A common first error is running a cell with nothing attached and then looking for a bug in the code.
- Reading a table with only
SELECT. In Unity Catalog,SELECTon a table is not enough. The user also needsUSE CATALOGon the parent catalog andUSE SCHEMAon the parent schema. A "permission denied" or "not found" error on a table you know exists often means a missingUSEprivilege. - Using the old two-level name. Older workspaces used a Hive metastore with
schema.tablenames. With Unity Catalog, the full name iscatalog.schema.table. A query that works on one workspace can fail on another if the default catalog differs. - Treating one kind of compute as universal. Interactive clusters, job compute, and SQL warehouses suit different tasks. Using an always-on interactive cluster for a nightly job is a typical source of avoidable cost.
Choosing where to start
For a first session, a sensible order is:
- Open the workspace and find your way around.
- Start or attach compute.
- Create a notebook and run a small query against a table.
- Inspect the table's history and permissions.
The next chapters follow this order. Each one adds one layer of the stack shown earlier.
Exercise
A colleague says, "Databricks stores our data, so if we stop using it we lose our tables." Using the stack in this chapter, give a more accurate description. Then name which two layers of the stack Databricks manages for you.
Show answer
With Delta Lake, table data is stored as open-format files (Parquet plus a transaction log) in cloud object storage in your own cloud account. Databricks does not hold that data in a proprietary store, so other engines can read the files. Databricks manages the compute layer (clusters, SQL warehouses, serverless) and the governance layer (Unity Catalog), along with the workspace tools built on them. Exactly what remains after you stop using Databricks depends on whether tables are managed or external, which a later chapter covers.
Exercise
An analyst has been granted SELECT on main.tutorial.orders but gets an error when querying it. Name the two additional privileges that are probably missing, and say where each applies.
Show answer
The analyst probably lacks USE CATALOG on the catalog main and USE SCHEMA on the schema main.tutorial. Unity Catalog checks privileges on the parent catalog and schema as well as on the table itself.