Skip to content

Target Adapters

A Sluice target adapter loads transformed records to the system that will own the data going forward. The open-source core ships with two built-in target adapters — csv and pg — that cover generic flat-file output and PostgreSQL bulk insert. ERP-specific adapters (bc, ifs, bluecherry) are paid add-ons from Caracal Lynx; their config is documented here so the same YAML works whether or not you have the add-on installed.

Every target has the same adapter field plus adapter-specific keys. The adapter value is one of:

csv | pg | bc | ifs | bluecherry | rest

For ERP adapters, see Commercial Support.

The simplest target. Writes the transformed staging table to a CSV file. Use this when you need a portable, human-readable load file or a CI artefact.

target:
adapter: csv
output: ./output/customers.csv
includeHeader: true
delimiter: ","
encoding: utf-8
nullValue: ""
KeyTypeDefaultNotes
outputstringPath to write.
includeHeaderbooleantrueWrite column names on the first row.
delimiterstring,Field delimiter.
encodingstringutf-8File encoding.
nullValuestring""How nulls are rendered.

Loads the staging table into a PostgreSQL table. Supports insert, ignore-on-conflict, and upsert modes.

target:
adapter: pg
connection: ${TARGET_PG}
table: customers
schema: public
onConflict: upsert
upsertKey: [customer_no]
KeyTypeDefaultNotes
connectionstringPostgreSQL connection string. Resolved from ${ENV_VAR} at runtime.
tablestringTarget table name.
schemastringpublicTarget schema.
onConflictenumfailfail | upsert | ignore.
upsertKeystring[]Required when onConflict: upsert. Column names that form the conflict key.

IFS imports CSV with no header row, in a column order defined by the IFS entity import contract.

target:
adapter: ifs
entity: CustomerInfo
output: ./output/acme-corp-customers-ifs.csv
includeHeader: false
columnOrder:
- CustomerNo
- Name
- Address1
- ZipCode
- Country
dateFormat: YYYY-MM-DD
KeyTypeDefaultNotes
entitystringIFS entity name (e.g. CustomerInfo, Supplier). Recorded in the load log.
outputstringPath to write.
includeHeaderbooleanfalseIFS expects no header.
columnOrderstring[]Forces the column order. Must match transform to: field names.
dateFormatstringYYYY-MM-DDdayjs format token.
delimiterstring,Field delimiter.
encodingstringutf-8File encoding.

Notes:

  • Date columns are formatted with dayjs using dateFormat.
  • The exact column order is critical — IFS imports by position, not by name.

bluecherry — BlueCherry ERP CSV import (paid add-on)

Section titled “bluecherry — BlueCherry ERP CSV import (paid add-on)”

BlueCherry (CGS) uses fixed-format CSV imports per entity type. The adapter validates required columns at connect() time, before any data is read, so misconfigured pipelines fail fast.

target:
adapter: bluecherry
entity: Style
output: ./output/style-co-styles-bc.csv
template: default
includeHeader: true
dateFormat: MM/DD/YYYY
nullValue: ""
KeyTypeDefaultNotes
entityenumOne of Style, Vendor, PurchaseOrder, PODetail, Season, ColourSize.
outputstringPath to write.
templatestringdefaultdefault uses built-in column order; or path to a header-only template CSV.
includeHeaderbooleantrueBlueCherry expects headers.
dateFormatstringMM/DD/YYYYBlueCherry is US-origin; default is US date format.
nullValuestring""How nulls are rendered.

Required columns per entity (validated at connect()):

EntityRequired columns
StyleStyleNo, StyleDesc, Division, Season, CostPrice, RetailPrice, ActiveFlag
VendorVendorNo, VendorName, Country, CurrencyCode
PurchaseOrderPONumber, VendorNo, Season, OrderDate, DeliveryDate
PODetailPONumber, StyleNo, ColourCode, SizeCode, Quantity, CostPrice
SeasonSeasonCode, SeasonDesc, StartDate, EndDate
ColourSizeStyleNo, ColourCode, ColourDesc, SizeCode, SizeDesc

Notes:

  • Any column whose name ends with Date (case-insensitive) is automatically formatted using dateFormat via dayjs.
  • If your BlueCherry instance uses different column names, point template at a header-only template CSV — the adapter uses that as the definitive column order.
  • These column names are conventions; verify against your BlueCherry import documentation before running a live migration.

bc — Business Central REST (paid add-on)

Section titled “bc — Business Central REST (paid add-on)”

Loads to Microsoft Dynamics 365 Business Central via OData REST. Uses OAuth 2.0 client credentials for authentication and OData $batch for throughput.

target:
adapter: bc
baseUrl: ${BC_BASE_URL}
company: ${BC_COMPANY}
entity: customers
apiVersion: v2.0
onConflict: upsert
batchEndpoint: true
KeyTypeDefaultNotes
baseUrlstringResolved from ${ENV_VAR}.
companystringBC company GUID or name.
entitystringOData entity name (lowercase, plural — e.g. customers, salesInvoices).
apiVersionstringv2.0OData API version.
onConflictenumfailfail | upsert | ignore. With upsert, a 409 triggers a PATCH.
batchEndpointbooleantrueUse OData $batch (max 100 ops per batch).

Notes:

  • OAuth 2.0 client credentials: POST https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token. Tokens are cached in memory and refreshed 60 seconds before expiry.
  • $batch endpoint: POST {baseUrl}/api/{apiVersion}/companies({company})/$batch with Content-Type: multipart/mixed; boundary=batch_{uuid}.
  • 4xx errors (other than 409 on upsert) are logged and rowsFailed is incremented; the run continues if run.onError: continue.

For systems Sluice doesn’t cover, implement the TargetAdapter interface as a Tier 2 file plugin or a Tier 3 npm package — see the Plugin System guide.