Guest User

Untitled

a guest
Feb 7th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. ## note this hasn't been tested, but should work after modification per the use case
  2. ## The ingredients to the recipe
  3. providers:
  4. -
  5. type: org1Students
  6. properties:
  7. username: [username]
  8. password: [password+securitytoken]
  9. query: SELECT Id, Name, ExternalIDField__c, Affiliation__c, First_Name__c, Last_Name__c FROM Student__c
  10. isSandbox: false
  11. schema:
  12. fields:
  13. - name: Id
  14. type: String
  15. - name: Name
  16. type: String
  17. - name: Affiliation__c
  18. type: String
  19. - name: First_Name__c
  20. type: String
  21. - name: Last_Name__c
  22. type: String
  23.  
  24. -
  25. type: org2Students
  26. properties:
  27. username: [username]
  28. password: [password+securitytoken]
  29. query: SELECT Id, Name, ExternalIDField__c, Affiliation__c, First_Name__c, Last_Name__c FROM Student__c
  30. isSandbox: false
  31. schema:
  32. fields:
  33. - name: Id
  34. type: String
  35. - name: Name
  36. type: String
  37. - name: Affiliation__c
  38. type: String
  39. - name: First_Name__c
  40. type: String
  41. - name: Last_Name__c
  42. type: String
  43.  
  44. -
  45. name: org2StudentWriter
  46. type: salesforce
  47. properties:
  48. username: [username]
  49. password: [password+securitytoken]
  50. sfObject: Student__c
  51. isSandbox: false
  52.  
  53. ### The instructions for how to mix the ingredients
  54. statements:
  55.  
  56. ## Data Pipeline #1 - Students
  57. - statement: |
  58. (joinedStudents) => select a.Id SourceId,
  59. b.Id TargetId,
  60. a.Name,
  61. a.ExternalIdField__c,
  62. a.First_Name__c,
  63. a.Last_Name__c
  64. from org1Students a
  65. left join org2Students b on a.ExternalIdField__c = b.ExternalIdField__c
  66. ### Insert
  67. - statement: |
  68. (newStudents) => select
  69. Name,
  70. ExternalIdField__c,
  71. First_Name__c,
  72. Last_Name__c
  73. from joinedStudents
  74. where TargetId is null
  75.  
  76. - statement: insert newStudents into org2StudentWriter
  77.  
  78. - statement: |
  79. (existingStudents) => select
  80. TargetId Id,
  81. Name,
  82. ExternalIdField__c,
  83. First_Name__c,
  84. Last_Name__c
  85. from joinedStudents
  86. where TargetId is not null
  87.  
  88. - statement: insert existingStudents into org2StudentWriter
Add Comment
Please, Sign In to add comment