Show Table Properties
Function
View table properties. SHOW TBLPROPERTIES is used to return key-value pair information of table properties. You can view all properties or the value of a specific property.
Syntax
SHOW TBLPROPERTIES [ db_name. ] table_name [ ( 'property_name' ) ]
Keywords
SHOW TBLPROPERTIES: Keyword for viewing table properties. TBLPROPERTIES and PROPERTIES are interchangeable.
Parameters
| Parameter | Mandatory | Description |
|---|---|---|
| db_name | No | Database name. If not specified, the current database is used by default. |
| table_name | Yes | Table name. |
| property_name | No | Property name, must be enclosed in single quotes. If not specified, all properties and their values are returned. If specified, only the value of that property is returned. Note: property_name is case-sensitive. Multiple property_name values cannot be specified simultaneously. Otherwise, an error will occur. |
Precautions
- property_name is case-sensitive. For example, owner and Owner are different properties.
- Multiple property_name values cannot be specified simultaneously. Otherwise, an error will occur.
- If the specified property_name does not exist, a null value is returned.
Example 1: View All Properties of a Table.
View all properties and their values for the employee table.
SHOW TBLPROPERTIES employee;
Example result:
+---------------------+--------------------+ |key |value | +---------------------+--------------------+ |owner |spark | |transient_lastDdlTime|1718534400 | +---------------------+--------------------+
Example 2: View the Value of a Specified Property
View the value of the property owner in the employee table.
SHOW TBLPROPERTIES employee ('owner'); Example result:
+-----+ |value| +-----+ |spark| +-----+
Example 3: View Properties of a Table with Custom Properties
First create a table with custom TBLPROPERTIES, then view its properties.
-- Create a table with custom properties.
CREATE TABLE employee (id INT, name STRING)
TBLPROPERTIES ('owner' = 'admin', 'department' = 'hr', 'created_by' = 'spark_sql');
-- View all properties.
SHOW TBLPROPERTIES employee; Example 4: Case Sensitivity of property_name
property_name is case-sensitive. The following queries will return different results.
-- View the value of the lowercase property name owner (correct match).
SHOW TBLPROPERTIES employee ('owner');
-- View the value of the uppercase property name Owner (different from owner, may return null).
SHOW TBLPROPERTIES employee ('Owner'); owner and Owner are treated as different property names. Ensure the case matches the definition when using.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot