display-medicalInsert / Update DB

Insert new employees and update existing employees using the Insert/Update step.

circle-exclamation

Workshop - Insert / Update DB


circle-info

Workshop files

Create a file named employees_insert_update.txt. Save it in the same folder as your transformation.

This workshop assumes a comma-delimited file with no header row:

1188,Firrelli,Julianne,x2174,[email protected],2,1143,Sales Manager
1619,King,Tom,x6324,[email protected],6,1088,Sales Rep
1810,Lundberg,Anna,x910,[email protected],2,1143,Sales Rep
1811,Schulz,Chris,x951,[email protected],2,1143,Sales Rep

Insert / Update
circle-info

Create a new transformation

Use any of these options to open a new transformation tab:

  • Select File > New > Transformation

  • Use Ctrl+N (Windows/Linux) or Cmd+N (macOS)


circle-info

Text file input

Read the incoming mixed feed from employees_insert_update.txt.

  1. Start Spoon.

circle-info
  1. Drag Text file input onto the canvas.

  2. Open the step properties.

  3. Configure the file path:

    • File: ${Internal.Transformation.Filename.Directory}/employees_insert_update.txt

Text File input - File
circle-info

If ${Internal.Transformation.Filename.Directory} is empty, save the transformation first.

  1. Select Content. Use the same delimiter settings as the screenshot.

Text file input - Content
  1. Select Get Fields.

  2. On Fields, confirm you have these stream fields:

    • EMPLOYEE_NUMBER

    • LASTNAME

    • FIRSTNAME

    • EXTENSION

    • EMAIL

    • OFFICECODE

    • REPORTSTO

    • JOBTITLE

Text File input - Fields
  1. Optional: select Preview. Confirm you get 4 rows.

  2. Select OK.

circle-check
chevron-rightTroubleshootinghashtag

All rows updated (no inserts) Those employee numbers already exist in EMPLOYEES.

All rows inserted (no updates) Your EMPLOYEENUMBER values were not found, or key mapping is wrong.

Duplicate key errors You likely used Table Output instead of Insert/Update, or you mapped keys incorrectly.

Updates affect too many rows Ensure EMPLOYEENUMBER is unique in your table. Fix duplicates before you upsert.

Last updated

Was this helpful?