POST_START
Using the Catalog.Schema.Object Three-Level Namespace in Databricks Unity Catalog
I recently started working on a new project in Databricks that involves organizing data assets using the Unity Catalog. One of the key concepts I needed to understand was the three-level namespace: Catalog.Schema.Object. I wanted to explore how to navigate and access objects using this structure. To do that, I followed a set of steps provided in the curriculum, which focused on using the training catalog and the sales schema.
Starting with the Catalog
I began by switching to the training catalog. This is the top-level namespace that contains all the schemas and objects I have access to. I ran the following command:
USE CATALOG training;
I saw a representative result like this:
Command completed successfully; the requested catalog state change is now in effect.
I noticed that the command completed successfully, which means I was now working within the training catalog. This is the first step in navigating the three-level namespace.
Switching to the Schema
Next, I wanted to explore the sales schema within the training catalog. I executed the following command:
USE SCHEMA sales;
I saw a representative result like this:
Command completed successfully; the requested catalog state change is now in effect.
This confirmed that I had successfully switched to the sales schema. Now, I was ready to query objects within this schema.
Querying the Object
I decided to start by querying the customers table. Since I was already in the sales schema, I could refer to the table directly:
SELECT * FROM customers;
I saw a representative result like this:
| customer_id | customer_name | region | status |
|---|---|---|---|
| 1001 | Maria Keller | EU | ACTIVE |
| 1002 | Daniel Smith | US | ACTIVE |
| 1003 | Sofia Rossi | EU | INACTIVE |
I learned that the customers table contains basic information about customers, such as their ID, name, region, and status. This gave me a clear view of the data structure.
Accessing the Object with the Full Namespace
To ensure I understood how the three-level namespace works, I decided to query the customers table using the full training.sales namespace:
SELECT * FROM training.sales.customers;
I saw a representative result like this:
| customer_id | customer_name | region | status |
|---|---|---|---|
| 1001 | Maria Keller | EU | ACTIVE |
| 1002 | Daniel Smith | US | ACTIVE |
| 1003 | Sofia Rossi | EU | INACTIVE |
This confirmed that I could access the table using the full three-level namespace. It reinforced the structure of the Unity Catalog and how it organizes data assets.
Conclusion
By following these steps, I gained a solid understanding of how to navigate and access objects within the Unity Catalog using the three-level namespace. I learned that the CATALOG, SCHEMA, and OBJECT levels are essential for organizing and querying data in a structured way. This knowledge will help me work more efficiently with data in Databricks.


Leave a Reply