pyspark.sql.Catalog.getTableProperties#

Catalog.getTableProperties(tableName)[source]#

Returns all table properties as a dict (same as SHOW TBLPROPERTIES).

New in version 4.2.0.

Parameters
tableNamestr

Table or view name. May be qualified with catalog and database (namespace).

Returns
dict

Map of property key to value.

Examples

>>> _ = spark.sql("DROP TABLE IF EXISTS tbl_props_doc")
>>> _ = spark.sql(
...     "CREATE TABLE tbl_props_doc (id INT) USING parquet "
...     "TBLPROPERTIES ('doc_prop_key' = 'doc_prop_val')"
... )
>>> spark.catalog.getTableProperties("tbl_props_doc")["doc_prop_key"]
'doc_prop_val'
>>> _ = spark.sql("DROP TABLE tbl_props_doc")