M.S.Visser
M.S.Visser

Reputation: 81

How to find out whether Spark table is parquet or delta?

I have a database with some tables in parquet format and others in delta format. If I want to append data to the table, I need to specify it if a table is in delta format (default is parquet). How can I determine a table's format?

I tried show tblproperties <tbl_name> but this gives an empty result.

Upvotes: 0

Views: 2843

Answers (1)

Rajan
Rajan

Reputation: 31

According to Delta lake Api Doc you can check

DeltaTable.isDeltaTable(Spark, "path")

Please see the note in the documentation

This uses the active SparkSession in the current thread to read the table data. Hence, this throws error if active SparkSession has not been set, that is, SparkSession.getActiveSession() is empty.

Upvotes: 1

Related Questions