I am having some trouble doing multiple operations out of a partial
branching operation. I'm not entirely sure how to approach this problem.
I have a csv file of products that I need to import into my database. I
also need to assign these products to categories and assign custom fields
to them. So I need to get the products into the
database first so I have a productid.
Right now I am running 4 separate EtlProcesses
1) Insert Products
2) Assign products to categories
3) Assign custom fields
4) Assign drop shipping information
I'd like to combine this into one operation for all products marked as
"insert" in my branch.
My InsertProducts operation looks something like this.
Register(new ProductJoinSourceToDestination().Left(new
ReadImportProductsFromFile<ImportProductRecord>(string.Format("{0}\\{1}",
_localFilePath, _localFileName))).Right(new
ConventionInputCommandOperation(_connectionString)
{
Command = "SELECT sku FROM products"
}));
Register(new
MapImportProductRecordToProductCartSchema(_connectionString));
Register(new BranchingOperation()
.Add(Partial
.Register(new Filter{Action = "insert"})
.Register(new
SqlBulkInsertProducts(_connectionString, _destinationTable))) <---
SqlBulkInsertOperation
.Add(Partial
.Register(new Filter{Action = "update"})
.Register(new
BatchUpdateProduct(_connectionString)))
);
I'd like to do something more like the following. This would allow me to
optimize the sql I am using immensely as I wouldn't have to check if a
product was already assigned a category, custom fields, etc before doing
the insert. (This data should not be updated but the ETL process)
Register(new BranchingOperation()
.Add(Partial
.Register(new Filter{Action = "insert"})
.Register(new
SqlBulkInsertProducts(_connectionString, _destinationTable)) <---
SqlBulkInsertOperation
.Register(new AssignProducts()) <---
SqlBatchOperation
.Register(new AssignCustomFields()) <---
SqlBatchOperation
.Register(new AssignDropShipperInfo())) <---
Sql BatchOperation
.Add(Partial
.Register(new Filter{Action = "update"})
.Register(new
BatchUpdateProduct(_connectionString)))
);
Right now if I try to do this, only SqlBulkInsertProducts is run. The rest
of the operations are skipped.
What is a better way to handle this scenario?
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rhino-tools-dev/-/laEzAtMQcMQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.