you can join
1. in the sql statement itself
2. as a JoinOperation you implement
3. transfer orders and then order lines independent of each other.
option 1 will require branching and aggregation to properly insert the
orders and order lines to the destination
option 2 doesn't make much sense given the data resides in the same
database
option 3 would work, but you would need to track which order lines to
pull after inserting the orders.
option 1 might look like this
Register(new ConventionInputCommand("source"){Command = "select * from
header left join lines ..."});
Register(new BranchingOperation()
.Add(Partial
.Register(new GroupHeader()) //
implements abstractaggreateoperation
.Register(new
ConventionOutputComand("destionation"){Command = "insert into
header ..."))
.Add(new ConventionOutputComand("destionation")
{Command = "insert into orderlines ..."));
option 3 might look like this
List<object> orderIds = new List<object>()
Register(new ConventionInputCommand("source"){Command = "select * from
header ..."});
Register(new CollectOrdeIds(orderIds));
Register(new ConventionInputCommand("source"){Command = "insert into
header ..."});
void PostProcessing()
{
if(GetAllErrors().Any()) return;
using(var process = new TransferOrderLines())
{
process.OrderIds = orderIds;
process.Execute();
}
}
class CollectOrdeIds : AbstractOperation
{
private readonly ICollection<object> ordeIds;
public CollectOrdeIds(ICollection<object> ordeIds)
{
this.orderIds = orderIds;
}
public IEnumerable<Row> Execute(IEnumerable<Row> rows)
{
foreach(var row in rows)
{
orderIds.Add(row["id"]);
yield return row;
}
}
}
On Dec 16, 9:43 am, Alex Brown <[email protected]> wrote:
> Hi
> I have a db with a structure similar to:
>
> Orders
> - ID
> - CustomerName
> - CustomerEmailAddress
> - DeliveryAddress
> - Transferred
>
> OrderLine
> - OrderID
> - ProductName
> - Price
>
> (you get the idea)
>
> I'm trying to create an ETL process using Rhino ETL that can copy
> these from ServerA sql server db to ServerB
>
> ServerB tables are identical, so there is no Transform to do as such.
>
> The only thing I need to do is after the transfer of each order (and
> it's corresponding OrderLine) is set Transferred to 1 (True) on the
> Orders table for that row.
>
> I've started this... but can't work out how to effectively Join the
> tables..?
> Is this something that can be done? Or should I have a separate
> process (and another Transferred column) on the OrderLine table?
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
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.