Practice Exam

Question 57 of 75

Implement Incremental Loading with Merge Insert

You work for MDFT Pro, a well-known training agency that tracks student course progress. Claire, a Data Engineer at MDFT Pro, manages a Fabric lakehouse named StudentProgressLakehouse that contains a table named EnrollmentStatus_Target with the following columns:

The data source system contains a table named EnrollmentStatus_Source with the same columns, which is used to populate EnrollmentStatus_Target with incremental updates. In a notebook named EnrollmentSyncNotebook, Claire loads EnrollmentStatus_Source to a DataFrame named sourceDF and EnrollmentStatus_Target to a DataFrame named targetDF. Claire needs to implement an incremental loading pattern using EnrollmentSyncNotebook that will add new student enrollment records. The solution must meet the following requirement: Insert all the records that exist in EnrollmentStatus_Source that do NOT exist in EnrollmentStatus_Target (new enrollments that haven’t been captured yet).

How should Claire complete the merge statement?

(targetDF
    .merge(sourceDF, "sourceDF.Key = targetDF.Key")
    ._______________ (
        values = {
            "targetDF.Key": "sourceDF.Key",
            "targetDF.LastModified": "sourceDF.LastModified",
            "targetDF.Status": "sourceDF.Status"
        }
    )
.execute()
)

Choose the correct answer from the options below.

Explanations for each answer:

Learn more about upserting into Delta Lake tables using merge:
Delta Lake Merge Operations
Next Question
Discuss this question on social media: