Creating and Inspecting Managed Tables

POST_START

Creating and Inspecting Managed Tables in Databricks Unity Catalog

I started by creating a new managed table in the Unity Catalog to store customer data for the sales team. The table needed to include customer identifiers, names, countries, emails, and timestamps for when each record was created. I used the CREATE TABLE command to define the structure of the training.sales.customers table.

CREATE TABLE training.sales.customers (customer_id BIGINT, customer_name STRING, country STRING, email STRING, created_at TIMESTAMP);

I saw a representative result like this:

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

I checked if the table was successfully created by listing all the tables in the training.sales schema. This helped me confirm that the table was registered in the Unity Catalog and was not a temporary table.

SHOW TABLES IN training.sales;

I saw a representative result like this:

database tableName isTemporary
sales customers false
sales orders false

I verified the table structure by using the DESCRIBE TABLE command. This gave me a clear view of the columns and their data types, which is essential for ensuring the table is set up correctly for future data ingestion and analysis.

DESCRIBE TABLE training.sales.customers;

I saw a representative result like this:

col_name data_type comment
customer_id bigint customer identifier
customer_name string customer display name
region string sales region

I wanted to see more detailed information about the table, including any additional metadata or comments. I used the DESCRIBE TABLE EXTENDED command to get a more comprehensive view of the table’s properties.

DESCRIBE TABLE EXTENDED training.sales.customers;

I saw a representative result like this:

col_name data_type comment
customer_id bigint customer identifier
customer_name string customer display name
region string sales region

Finally, I used the SHOW CREATE TABLE command to retrieve the exact SQL statement that was used to create the table. This is helpful for auditing, replication, or understanding how the table was initially set up.

SHOW CREATE TABLE training.sales.customers;

I saw a representative result like this:

createtab_stmt
CREATE VIEW production.reporting.daily_sales AS SELECT …

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.