Your first Databricks Free Edition notebook: which routes deliver late?

Open Databricks Free Edition and upload the CSV to a Unity Catalog volume. Import the notebook, validate dates with Python and save the rows in a Delta table. Group by route in SQL. Divide late shipments by completed deliveries with valid dates, then chart the percentage.

Get the project

Starting out ·

The problem

You have a shipment CSV with promised and actual delivery dates. You want to know which routes deliver late and check the answer by hand. Some shipments are still open and some dates are impossible. Counting them as on time makes the rate look better while the underlying service stays the same.

What Free Edition includes

Free Edition is a no-cost workspace for personal learning and experiments. It includes serverless compute, default storage, Python and SQL notebooks, Unity Catalog, visualizations and limited options for jobs and machine learning. This exercise uses one serverless notebook. Its SQL runs inside the notebook.

Compute has a quota. Databricks may suspend it until the limit resets. Outbound internet access is restricted, so upload the CSV from your computer. Free Edition has one 2X-Small SQL warehouse and doesn’t support classic clusters, R or Scala. It is for personal, non-commercial use. Choose Free Edition at signup. Databricks also offers a time-limited trial on different terms.

The exercise goes from Free Edition registration to a Unity Catalog volume, a notebook and a Delta table with a SQL chart.

Databricks Free Edition limitations · Free trial and Free Edition

Steps

  1. Open the official signup guide and follow its Free Edition signup link. Choose email, Google or Microsoft from the options shown. Complete email verification if prompted. Databricks creates a workspace you can open after signing up. Official registration guide
  2. Download the two project files. In Catalog, open a catalog where you can create objects. Make a schema called tfod_delivery_lab and a managed volume called shipping_files inside it. The volume holds the CSV. The Delta table will hold rows you can query. Create a managed volume
  3. From the sidebar, choose New → Add or upload data → Upload files to a volume. Select shipments.csv and your new volume. Confirm that the file appears in shipping_files. Official upload screenshot
  4. In Workspace, open the folder menu and choose Import. Select shipment_lab.py. Connect it to Serverless. Run the setup cells to show the catalog, schema and volume fields. Enter the names from Catalog, then run the remaining cells in order. Official import guide
  5. Read the Python result. A valid date is in ISO format and exists in the calendar. A shipment with a valid promised date and a blank actual date is open. A required date that fails validation makes it invalid. A later delivery is late, and the other valid deliveries are on_time. The notebook checks for duplicate IDs before writing the Delta table shipment_status_lab to the practice schema.
  6. Read the final SQL cell. It groups by route and counts valid deliveries, late deliveries, open shipments and invalid rows separately. Central has two late deliveries out of three valid ones, or 66.67%. Coast has two valid deliveries and none late. Remote has no valid deliveries, so it has no rate.
  7. In the final output, select + → Visualization → Bar. Set route on X and late_pct on Y. The values already use a 0–100 scale. Use the table to distinguish 0% from a missing rate. A second notebook run should still leave 13 shipments. Official chart editor screenshots

Four shipment statuses. On-time and late count in the rate; open and invalid appear separately.

The project

Get the project

Download the two files for the exercise. shipments.csv · shipment_lab.py

The local run kept 13 shipments: 7 valid deliveries, 4 open and 2 with invalid dates. Central showed 66.67% late, North 50%, Coast 0%, and Remote had no rate. Two Delta writes left 13 rows in the table.

Local SQL results. Central 66.67%, North 50%, Coast 0%, and Remote has no rate.

Copy this prompt

Want the same late-delivery rate for another Databricks table? Paste this into your assistant’s chat and name the table, the route and status columns, and the values that represent each status. You’re asking for a SQL query adapted to those columns that you can try in your notebook.

Write a Spark SQL query for Databricks using <catalog.schema.table>.
Here are the route and status columns and the values that represent each status: <columns and values>.
For each route, show late deliveries, completed deliveries with valid dates, open shipments and invalid shipments.
Return late deliveries as a percentage of valid completed deliveries, with NULL when the denominator is zero.
Provide a query I can test in the notebook.

Try the query with a route you can count by hand. A route with no valid deliveries should return NULL.

Test result

In Spark 4.0.1 and Delta Lake 4.0.0, Central had a 66.67% late rate, two of three valid deliveries. Remote had no rate. Writing the table twice kept 13 shipments.

Limits

Use a practice schema. The notebook replaces its shipment_status_lab table. The recorded run used local Spark and Delta Lake. Signup, Unity Catalog menus and the visualization editor follow the official documentation.

Sources

Author

Rodrigo Lombana Reina, data engineer. Personal opinions.

Questions

How does Free Edition differ from the Databricks free trial?

Free Edition gives you a no-cost workspace for personal learning and experiments with a serverless usage quota. Databricks also offers a time-limited free trial with separate conditions for evaluating the platform. Follow the Free Edition signup link in the official guide to get the account this exercise uses.

What can I practise in Free Edition, and what is outside it?

You can practise with Python and SQL notebooks, Unity Catalog, Delta tables and charts. Databricks also documents quota-limited jobs and experiments. Compute in Free Edition is serverless, outbound internet access is restricted, and classic clusters, R and Scala are unavailable. The account is for personal, non-commercial use.

Where can I upload the CSV if the notebook can't download it?

Upload from the workspace interface. Choose New, Add or upload data, then Upload files to a volume. Select the volume you created inside your practice schema. The notebook reads the file from the volume through Unity Catalog using the names entered in its setup fields.

Why do open shipments and invalid dates stay out of the rate?

The metric covers completed deliveries that can be compared with a promised date. Open shipments lack an actual date and invalid rows lack a usable date for the comparison. Both counts remain in the result, so readers can see how many records were excluded and why.

How can I check the rate that the notebook returns?

Start with the counts. Central has two late deliveries out of three and North one out of two. Coast has valid deliveries and none late, so it shows 0%. Remote has no eligible deliveries and its rate is empty. Running the write a second time should leave 13 shipments.

Portrait of Rodrigo Lombana Reina

Rodrigo Lombana Reina, data engineer. Data problems solved, step by step.

About Rodrigo · The opinions and texts on this site are my own.

My LinkedIn profile