Skip to main content

Smart Copy

Introduction

Smart copy produces a subset of the staging schema, called staging_to_upload, which contains just the entities to be uploaded into Salesforce. This is done by marking an account tree to be uploaded by adding the Migration ID to the id column to the staging_to_load table in the utilities schema. The smart delete task in 06_upload_data_to_salesforce will then wipe the staging_to_upload schema and copy just that account and all associated entities into that schema.

Process

The smart copy process is determined by the types of relationships defined in the configuration file. By defining the relationships in your v12 data model Monarch will automatically determine what records are a part of a provider tree. To ensure that the smart copy process is completed correctly follow these guidelines:

  1. Define all foreign keys in your model where both the object and the reference object are being loaded with your data load
    • This means if your contact object is dependent on accounts you must define that relationship in the "object" contact.
    • Pay special attention to child vs parent relationship type as explained in the config section
  2. Any references or lookups that are not included in your data model, for instance if you are seeding a salesforce table separetely, do not define a lookup to that table instead use the remap instructions configuration to remap to the salesforce id.