nerdexam
Microsoft

DP-700 · Question #98

You have a Fabric workspace that contains a lakehouse named Lakehouse1. Lakehouse1 contains a table named Status_Target that has the following columns: - Key - Status - LastModified The data source…

The code snippet for completing the statement:``python .merge(sourceDF, "sourceDF.Key" = "targetDF.Key") .whenMatchedUpdate( set = {"targetDF.LastModified": "sourceDF.LastModified"} ) .whenNotMatchedInsert( values = {"targetDF.Key": "sourceDF.Key", "targetDF.LastModified"…

Design and implement data ingestion and transformation

Question

You have a Fabric workspace that contains a lakehouse named Lakehouse1. Lakehouse1 contains a table named Status_Target that has the following columns: - Key - Status - LastModified The data source contains a table named Status_Source that has the same columns as Status_Target. Status_Source is used to populate Status_Target. In a notebook name Notebook1, you load Status_Source to a DataFrame named sourceDF and Status_Target to a DataFrame named targetDF. You need to implement an incremental loading pattern by using Notebook1. The solution must meet the following requirements: - For all the matching records that have the same value of key, update the value of LastModified in Status_Target to the value of LastModified in Status_Source. - Insert all the records that exist in Status_Source that do NOT exist in Status_Target. - Set the value of Status in Status_Target to inactive for all the records that were last modified more than seven days ago and that do NOT exist in Status_Source. How should you complete the statement? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Exhibit

DP-700 question #98 exhibit

Explanation

The code snippet for completing the statement:```python .merge(sourceDF, "sourceDF.Key" = "targetDF.Key")

.whenMatchedUpdate( set = {"targetDF.LastModified": "sourceDF.LastModified"} ) .whenNotMatchedInsert( values = {"targetDF.Key": "sourceDF.Key", "targetDF.LastModified": "sourceDF.LastModified", "targetDF.Status": "sourceDF.Status"} ) .whenNotMatchedBySourceUpdate( condition = "targetDF.LastModified" < (current_date() - INTERVAL '7' DAY)", set = {"targetDF.Status": "inactive"} ) .execute()


Dropdown selections:
1. .whenMatchedUpdate
2. .whenNotMatchedInsert
3. .whenNotMatchedBySourceUpdate

Available options for each dropdown: .whenMatchedInsert, .whenMatchedUpdate, .whenNotMatchedBySourceInsert, .whenNotMatchedBySourceUpdate, .whenNotMatchedInsert, .whenNotMatchedUpdate

Topics

#Incremental Loading#Delta Lake Merge#Spark DataFrames#Data Transformation

Community Discussion

No community discussion yet for this question.

Full DP-700 Practice