Forum Discussion

RRASUK9900's avatar
RRASUK9900
Regular Visitor
1 year ago
Solved

Error: Specified Cast is not valid / Data Pipeline Copy Activity

Error: Specified Cast is not valid / Data Pipeline Copy Activity   Source: SQL endpoint (Another Lakehouse SQL endpoint) Destination: Lakehouse   The Key Column and Modified_datetime columns wer...
  • v-hashadapu's avatar
    1 year ago

    Hi RRASUK9900 , Thank you for reaching out to the Microsoft Community Forum.

     

    This error usually means the source and Lakehouse table schemas don’t fully match, most often in key_column or Modified_datetime. Even if the types look correct, hidden issues like nulls or invalid formats (especially in dates) can break Fabric’s internal casting during Upsert.

     

    Since the Upsert feature in Fabric is still in preview, its error messages are vague and unlike Append or Overwrite, it uses merge logic that’s more fragile. That’s why those modes work while Upsert fails, the problem likely occurs during internal comparisons or casts in the merge.

     

    The best thing to do right now is to avoid Upsert in the Copy Activity. Instead, load your data into a staging Lakehouse table with Append mode, then run a manual MERGE in a Spark Notebook. This gives you full control, better visibility and clearer errors. Just be sure to cast key columns explicitly in your source query to match the destination types and test with a small dataset first to catch edge cases early.

     

    If this helped solve the issue, please consider marking it “Accept as Solution” so others with similar queries may find it more easily. If not, please share the details, always happy to help.
    Thank you.