Problem
When creating or querying a view using time travel syntax in a Unity Catalog (UC)-enabled cluster, you receive an error message.
Query
CREATE OR REPLACE VIEW <schema-name>.<view-name> AS
SELECT * FROM <schema-name>.<table-name>@v1234
Error
com.databricks.sql.transaction.tahoe.DeltaAnalysisException: [DELTA_UNSUPPORTED_TIME_TRAVEL_MULTIPLE_FORMATS] Cannot specify time travel in multiple formats.
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveTimeTravel$$anonfun$apply$15.applyOrElse(Analyzer.scala:2042)
at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveTimeTravel$$anonfun$apply$15.applyOrElse(Analyzer.scala:2040)
Cause
Delta Lake allows you to reference specific table versions using time travel, but it requires a consistent format for specifying the version or timestamp. The view definition syntax from Hive does not carry over to UC-enabled clusters.
Solution
Ensure that you use a three-level namespace (database.schema.table) when creating views in UC.
Check the syntax for specifying time travel in your query and ensure that it is consistent.
If you need to use multiple formats for specifying time travel, simplify the query to use a single format.
CREATE OR REPLACE VIEW <database-name>.<schema-name>.<view-name> AS
SELECT * FROM <database-name>.<schema-name>.<table-name>@v1234