Hi Michael,
I am finding it hard to see that you can obtain what you want without a staging table (which are very commonly used). And it doesn't really take that many steps.
- Create staging table
- Create SQL View that will combine visma data with EcomProduts - and let this be you new source
- Setup import job that imports from your Excel to the staging table,
- You may want to check the checkbox "Remove missing rows after import in the destination tables only", as this will ensure having the staging table contain only what is imported in current import, clearing obsolete rows.
- Setup the final job that imports from staging table (SQL Provider) to EcomProducts (Ecom Provider)
1) Creating staging table - here named 'VISMA' (you can do this from Firehose)
The table is based on the schema of your current import job.
CREATE TABLE [dbo].[VISMA]
(
[ProductVariantId] nvarchar(255) NULL,
[ProductLanguageId] nvarchar(50) NULL,
[VISMA_DK_KEY] nvarchar(255) NULL,
[ProductName] nvarchar(500) NULL,
[ProductCategory|Product|ProductType] nvarchar(255) NULL,
[ProductCategory|Wine|Vintage] nvarchar(255) NULL,
[ProductCategory|Wine|ABV] nvarchar(255) NULL,
[ProductCategory|Wine|Size] nvarchar(255) NULL,
[ProductCategory|Wine|ServingTemperature] nvarchar(255) NULL,
[ProductCategory|Wine|Closure] nvarchar(255) NULL,
[ProductCategory|Wine|Country] nvarchar(255) NULL,
[ProductCategory|Wine|Region] nvarchar(255) NULL,
[ProductCategory|Wine|District] nvarchar(255) NULL,
[ProductCategory|Wine|Denomination] nvarchar(255) NULL,
[ProductCategory|Wine|Appellation] nvarchar(255) NULL,
[ProductCategory|Wine|Classification] nvarchar(255) NULL,
[ProductCategory|Wine|Vineyard] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVariety1] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVarietyPct1] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVariety2] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVarietyPct2] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVariety3] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVarietyPct3] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVariety4] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVarietyPct4] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVariety5] nvarchar(255) NULL,
[ProductCategory|Wine|GrapeVarietyPct5] nvarchar(255) NULL,
[SalesUnitEAN] nvarchar(255) NULL,
[SalesUnitLength] nvarchar(255) NULL,
[SalesUnitWidth] nvarchar(255) NULL,
[SalesUnitHeight] nvarchar(255) NULL,
[SalesUnitNetWeight] nvarchar(255) NULL,
[SalesUnitGrossWeight] nvarchar(255) NULL,
[CartonUnitEAN] nvarchar(255) NULL,
[CartonUnitLength] nvarchar(255) NULL,
[CartonUnitWidth] nvarchar(255) NULL,
[CartonUnitHeight] nvarchar(255) NULL,
[CartonUnitNetWeight] nvarchar(255) NULL,
[CartonUnitGrossWeight] nvarchar(255) NULL,
[CartonUnitQty] nvarchar(255) NULL,
[PalletUnitEAN] nvarchar(255) NULL,
[PalletUnitLength] nvarchar(255) NULL,
[PalletUnitWidth] nvarchar(255) NULL,
[PalletUnitHeight] nvarchar(255) NULL,
[PalletUnitNetWeight] nvarchar(255) NULL,
[PalletUnitGrossWeight] nvarchar(255) NULL,
[PalletUnitCartonsPerLayer] nvarchar(255) NULL,
[PalletUnitCartonsPerPallet] nvarchar(255) NULL
);
For the ease of example, I've set all to nvarchar.
2) Create view that will be your new source (you can do this from Firehose)
CREATE OR ALTER VIEW [dbo].[VISMA_ProductImport]
AS
SELECT
p.[ProductId],
p.[ProductVariantId],
p.[ProductLanguageId],
p.[ProductNumber],
v.[VISMA_DK_KEY],
v.[ProductName],
v.[ProductCategory|Product|ProductType],
v.[ProductCategory|Wine|Vintage],
v.[ProductCategory|Wine|ABV],
v.[ProductCategory|Wine|Size],
v.[ProductCategory|Wine|ServingTemperature],
v.[ProductCategory|Wine|Country],
v.[ProductCategory|Wine|Region],
v.[ProductCategory|Wine|District],
v.[ProductCategory|Wine|Denomination],
v.[ProductCategory|Wine|Appellation],
v.[ProductCategory|Wine|Classification],
v.[ProductCategory|Wine|Closure],
v.[ProductCategory|Wine|GrapeVariety1],
v.[ProductCategory|Wine|GrapeVarietyPct1],
v.[ProductCategory|Wine|GrapeVariety2],
v.[ProductCategory|Wine|GrapeVarietyPct2],
v.[ProductCategory|Wine|GrapeVariety3],
v.[ProductCategory|Wine|GrapeVarietyPct3],
v.[ProductCategory|Wine|GrapeVariety4],
v.[ProductCategory|Wine|GrapeVarietyPct4],
v.[ProductCategory|Wine|GrapeVariety5],
v.[ProductCategory|Wine|GrapeVarietyPct5],
v.[SalesUnitEAN],
v.[SalesUnitLength],
v.[SalesUnitWidth],
v.[SalesUnitHeight],
v.[SalesUnitNetWeight],
v.[SalesUnitGrossWeight],
v.[CartonUnitEAN],
v.[CartonUnitLength],
v.[CartonUnitWidth],
v.[CartonUnitHeight],
v.[CartonUnitNetWeight],
v.[CartonUnitGrossWeight],
v.[CartonUnitQty],
v.[PalletUnitEAN],
v.[PalletUnitLength],
v.[PalletUnitWidth],
v.[PalletUnitHeight],
v.[PalletUnitNetWeight],
v.[PalletUnitGrossWeight],
v.[PalletUnitCartonsPerLayer],
v.[PalletUnitCartonsPerPallet]
FROM [dbo].[VISMA] AS v
INNER JOIN [dbo].[EcomProducts] AS p
ON p.[VISMA_DK_KEY] = v.[VISMA_DK_KEY]
AND p.[ProductLanguageId] = v.[ProductLanguageId]
WHERE NULLIF(v.[VISMA_DK_KEY], N'') IS NOT NULL
AND NULLIF(v.[ProductLanguageId], N'') IS NOT NULL;
With this view you will have a source with the unique keys from EcomProducts that you need. Let the native key columns be your key in the final import job that you set up (point 4):
- ProductId
- ProductVariantId
- ProductLanguageId
The view will list all product rows having the visma_key(s) in current Excel - and will have the unique composite key you're currently missing.
Now setup the final job that uses SQL Provider as source - this provider will give you access to SQL Views, and let it point to your view, in this example named 'VISMA_ProductImport'.
Hope the above is useful.
/Snedker