- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 07:09 AM
Unfortunately, it didnt work that way, expect don't see scalar values saved as variables
@dlt.expect_or_fail("equal_number_of_records", "qa_silver_row_count == bronze_count")
@dlt.table()
def silver():
bronze_count == bronze_table.count()
silver_table = # transformations on bronze table
silver_table = silver_table.withColumn("qa_silver_row_count", F.lit(silver_table.count()))
The way I manage to make it run is:
@dlt.expect_or_fail("equal_number_of_records", "qa_silver_row_count == qa_bronze_row_count")
@dlt.table()
def silver():
bronze_table = #load bronze table
silver_table = upstream_table.withColumn("qa_bronze_row_count", F.lit(bronze_table..count()))
silver_table = # transformations on bronze table
silver_table = silver_table.withColumn("qa_silver_row_count", F.lit(silver_table.count()))
It is a little bit cumbersome. It is a little annoying that DLT actually makes row count automatically but it can't be easily accessed. Maybe it is possible to get this data from the event log table I will try to find out