Skip to content

Not able to run bulk upserts using merge statements. #359

@paarivarik-engineer

Description

@paarivarik-engineer
  1. Describe your new request in detail
    Consider I'm running below query using executemany and feed my data in form of a list of touples generated from a df or anything.
    Ideally I was expecting this to work but its not working sadly. can someone suggest if I can do some workout here to make this work because I have been scratching my head for this around days now. apologies if its a already solved issue and someone can point me in the right direction.

  2. Give supporting information about tools and operating systems. Give relevant product version numbers
    Query :
    merge into RMS_INTERNAL OLD
    using ( SELECT :1 as RM_NAME,:2 as ASSIGNING_MONTH, :3 as ASSIGNING_WEEK, :4 as SOURCE, :5 as TOTAL_ASSIGNED, :6 as TOTAL_NOT_QUALIFIED, :7 as TOTAL_QUALIFIED, :8 as TOTAL_CHANGED from dual ) new
    ON ( OLD.RM_NAME = new.RM_NAME and OLD.ASSIGNING_WEEK = new.ASSIGNING_WEEK
    and OLD.ASSIGNING_WEEK = new.ASSIGNING_WEEK
    and OLD.SOURCE = new.SOURCE
    and OLD.TOTAL_ASSIGNED = new.TOTAL_ASSIGNED
    and OLD.TOTAL_NOT_QUALIFIED = new.TOTAL_NOT_QUALIFIED
    and OLD.TOTAL_QUALIFIED = new.TOTAL_QUALIFIED
    and OLD.TOTAL_CHANGED = new.TOTAL_CHANGED
    )
    when matched then update set
    OLD.ASSIGNING_MONTH = concat(new.RM_NAME,'_updated')
    when not matched then insert
    values (new.RM_NAME, new.ASSIGNING_MONTH, new.ASSIGNING_WEEK, new.SOURCE, new.TOTAL_ASSIGNED, new.TOTAL_NOT_QUALIFIED, new.TOTAL_QUALIFIED, new.TOTAL_CHANGED ) ; """

Data : [('test'.. and so on)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions