[Python] Merge with Multiple Conditions in DeltaTable using Pyspark

Discussão em 'Python' iniciado por Stack, Dezembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I built a process using Delta Table to upsert my data with the ID_CLIENT and ID_PRODUCT key but I am getting the error:


    Merge as multiple source rows matched
    ​

    Is it possible to perform the merge with multiple conditions?

    tabela_spec.alias("current") \
    .merge(dfrn.alias("update"), "current.id_client = update.id_client AND current.id_product = update.id_product") \
    .whenMatchedUpdateAll().whenNotMatchedInsertAll() \
    .execute()

    Continue reading...

Compartilhe esta Página