RhinoETL - joining two tables as input, writing to two tables at the output

I am writing an ETL job in C # using Rhino ETL

I have a database on ServerA. This has 2 tables:

(example)

tblOrder

  • OrderID
  • CustomerName
  • CustomerEmailAddress
  • Submitted

tblOrderLine

  • OrderID
  • Productid
  • Productname
  • Price

In ServerB, it has an identical table (orders are transferred from the Internet to our backend system)

Using RhinoETL, my InputCommandOperation looks like this:

class ReadOrdersFromWebDB : InputCommandOperation
{
    public ReadOrdersFromServerA(ConnectionStringSettings connectionStringSettings)
        : base(connectionStringSettings) { }

    protected override Row CreateRowFromReader(IDataReader reader)
    {
        return Row.FromReader(reader);
    }

    protected override void PrepareCommand(IDbCommand cmd)
    {
        cmd.CommandText = "SELECT TOP 10 * FROM tblOrders WHERE Transferred = 0";
    }
}

Since there are no transformations at this stage, my OutputCommandOperation will look like this:

class WriteOrdersToServerB : OutputCommandOperation
{
    protected override void PrepareCommand(IDbCommand cmd, Row row)
    {
        cmd.CommandText =
@"INSERT INTO etc...........";
    }
}

, , tblOrderLine ServerA - , db (join) "" tblOrderLine InputCommand, .

InputCommand? ?

+3
1

, , ServerA ServerB, , , ServerA 2 ServerB.

tblOrder tblOrderLine 1 , . , , SELECT TOP n tblOrderLine. 1 1, , , , .

Transferred tblOrderLine, OrderID, tblOrder, , tblOrderLine .

SELECT TOP 10 * 
FROM tblOrder
WHERE Transferred = 0

OrderID, , tblOrderLine .

SELECT *
FROM tblOrderLine
WHERE OrderID IN /* list of saved OrderID */
0

Source: https://habr.com/ru/post/1780259/


All Articles