Creating, Inspecting, Using, and Managing Unity Catalog Catalogs

POST_START

Creating, Inspecting, Using, and Managing Unity Catalogs

I started my day by exploring the Unity Catalog in Databricks, a critical part of our data governance strategy. I wanted to understand how to create, inspect, use, and manage catalogs effectively. My first step was to check what catalogs already existed in the environment.

SHOW CATALOGS;

I saw a representative result like this:

catalog
main
production
training

I noticed that the ‘training’ catalog was already present, but I wanted to ensure that it was properly configured and owned by the right team. I decided to describe the catalog to get more details about its current state.

DESCRIBE CATALOG training;

I saw a representative result like this:

info_name info_value
Catalog Name production
Owner data_platform_admins

Wait, the catalog name in the result was ‘production’, but I was looking at ‘training’. That didn’t match what I expected. I realized that maybe the ‘training’ catalog wasn’t properly described, or perhaps there was a naming discrepancy. To be thorough, I decided to create the ‘training’ catalog explicitly, just to ensure it was set up correctly.

CREATE CATALOG IF NOT EXISTS training;

I saw a representative result like this:

Command completed successfully; the requested catalog state change is now in effect.

I verified that the catalog was created successfully. Next, I wanted to confirm that the ‘training’ catalog was now the active one. I used the ‘USE CATALOG’ command to switch to it.

USE CATALOG training;

I saw a representative result like this:

Command completed successfully; the requested catalog state change is now in effect.

Now that I was in the ‘training’ catalog, I wanted to make sure that the current catalog was indeed ‘training’. I ran the ‘SELECT current_catalog()’ command to verify the active catalog.

SELECT current_catalog();

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

Wait, the output was a table of customer data, not the catalog name. That was unexpected. I realized that the ‘current_catalog()’ function might be returning data from a table in the current catalog, not the catalog name itself. I decided to double-check the ownership of the ‘training’ catalog to ensure it was assigned to the right team.

ALTER CATALOG training SET OWNER TO `data_engineers`;

I saw a representative result like this:

Command completed successfully; the requested catalog state change is now in effect.

I verified that the ownership was successfully changed to the ‘data_engineers’ team. Finally, I wanted to clean up by removing the ‘training’ catalog, just to see what happens when it’s dropped.

DROP CATALOG IF EXISTS training;

I saw a representative result like this:

Command completed successfully; the requested catalog state change is now in effect.

With that, I concluded my session on managing Unity Catalogs. I learned how to create, inspect, use, and manage catalogs effectively, and how to verify their state and ownership using the available commands.

Leave a Reply

Your email address will not be published. Required fields are marked *

We use cookies and similar technologies to enhance your experience on wobizdu.com, analyze site traffic, personalize content, and deliver relevant ads. Some cookies are essential for the site to function, while others help us improve performance and user experience. You may accept all cookies, decline optional ones, or customize your settings. Review our Privacy Policy to learn more.