2

I have the following piece of code and able to run as a DLT pipeline successfully

@dlt.table(
        name = source_table
    )
    def source_ds():
        return spark.table(f"{raw_db_name}.{source_table}")


    ### Create the target table definition
    dlt.create_streaming_live_table(name=target_table,
         comment= f"Clean, merged {target_table}",
         #partition_cols=["topic"],
         table_properties={
             "quality": "silver"
         }
     )

If I try to view the history using time travel, am getting the error: For eg.,

describe history my_db.employee_trasaction

Error:

AnalysisException: Cannot describe the history of a view.

I need to also create a sync process so as to have these ables in Unity Catalog and am referring to this document (https://www.databricks.com/blog/2022/11/03/how-seamlessly-upgrade-your-hive-metastore-objects-unity-catalog-metastore-using).

When I checked table properties, the type is shown as VIEW? enter image description here

How do I make these tables as DELTA so they are available for time travel, and for unity catalog

When I tried sync command for EXTERNAL TABLES or VIEWS, am getting errors as VIEWS not supported Screen shot for a sync command VIEW table: enter image description here

Screen shot for a sync command for EXTERNAL tables: enter image description here

Yuva
  • 2,831
  • 7
  • 36
  • 60

2 Answers2

1

How do I make these tables as DELTA so they are available for time travel, and for unity catalog

edit: As of August 2023, publishing to Unity Catalog is supported.

Let me answer the last part of your question about Unity Catalog (UC).

What I learnt just recently is that you can Publish data from Delta Live Tables pipelines (using Target schema in Destination section of a DLT pipeline's setting), but not to Unity Catalog (!)

You cannot publish tables to Unity Catalog. Delta Live Tables supports publishing tables only to the workspace-level Hive metastore.

Target schema

adrien
  • 504
  • 1
  • 7
  • 17
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
1

When implementing SCD Type 1 or 2, Delta Live Tables writes additional data that allows it to guarantee that you get correct data. To hide that additional data, it creates a view on top of the actual Delta Lake table. So you need to perform time travel on the actual Delta table whose name/path you can find in the view definition.

Regarding UC support, Jacek is correct - it's not available now, but should be available in the few months (I think that quarterly roadmap webinar mentioned that). As of right now you can use the SYNC SQL command if you want to expose DLT tables in some UC catalog.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
  • Views are not supported yet for sync commands, I have added screen shot for your reference. thanks – Yuva Mar 06 '23 at 05:44