Skip to content

Table Properties

Delta Lake allows setting up table properties for a custom behaviour of a delta table.

SHOW TBLPROPERTIES

Table properties can be displayed using SHOW TBLPROPERTIES SQL command:

SHOW TBLPROPERTIES <table_name> [(comma-separated properties)]

sql("SHOW TBLPROPERTIES delta.`/tmp/delta/t1`").show(truncate = false)
+----------------------+-----+
|key                   |value|
+----------------------+-----+
|delta.minReaderVersion|1    |
|delta.minWriterVersion|2    |
+----------------------+-----+
sql("SHOW TBLPROPERTIES delta.`/tmp/delta/t1` (delta.minReaderVersion)").show(truncate = false)
+----------------------+-----+
|key                   |value|
+----------------------+-----+
|delta.minReaderVersion|1    |
+----------------------+-----+

ALTER TABLE SET TBLPROPERTIES

Table properties can be set a value or unset using ALTER TABLE SQL command:

ALTER TABLE <table_name> SET TBLPROPERTIES (<key>=<value>)
ALTER TABLE table1 UNSET TBLPROPERTIES [IF EXISTS] ('key1', 'key2', ...);

sql("ALTER TABLE delta.`/tmp/delta/t1` SET TBLPROPERTIES (delta.enableExpiredLogCleanup=true)")
sql("SHOW TBLPROPERTIES delta.`/tmp/delta/t1` (delta.enableExpiredLogCleanup)").show(truncate = false)
+-----------------------------+-----+
|key                          |value|
+-----------------------------+-----+
|delta.enableExpiredLogCleanup|true |
+-----------------------------+-----+

Last update: 2021-04-24
Back to top