Chaining InputOperations in Rhino-Etl

94 views
Skip to first unread message

Brian Ogletree

unread,
Nov 28, 2013, 11:47:27 AM11/28/13
to rhino-t...@googlegroups.com

Apologize for cross posting.  But didn't realize StackOverflow may not have been the best place to originally post this question.

I've just recently started using Rhino-Etl for very simple ETL processes and have had great success with it. I have a slightly more complicated scenario to address now and I didn't find the ConventionInputCommandOperation behaving the way I expected.

I've done up a very simplified example of what I'm trying to do. Basically I have two systems involved and I don't know what I want to get from system 2 until I first query system 1. I thought registering an InputOperation immediately after another InputOperation would behave like a loop. So that each row in operation 1 would be fed to operation 2. The below code fails with "Failed to execute operation DetailReader: Must declare the scalar variable @PlanetAbbrv." So my question is how are you meant to handle situations where the input operation is dependent a previous input operation?

Thanks, Brian

using System;
using Rhino.Etl.Core;
using Rhino.Etl.Core.ConventionOperations;

namespace ETLTest
{
    class Program
    {
        static void Main()
        {
            new MainProcess().Execute();
            Console.ReadLine();
        }
    }

    public class MainProcess : EtlProcess
    {
        protected override void Initialize()
        {
            Register(new MainReader());
            Register(new DetailReader());
        }

        protected override void PostProcessing()
        {
            foreach (var exception in GetAllErrors())
            {
                throw exception;
            }
        }
    }

    public class MainReader : ConventionInputCommandOperation
    {
        public MainReader() : base("Galactic1")
        {
            Command = @"select * from Planet";
        }
    }

    public class DetailReader : ConventionInputCommandOperation
    {
        public DetailReader() : base("Galactic2")
        {
            Command = @"select * from Delivery where DeliveryPlanetAbbrv = @PlanetAbbrv";
        }
    }
}

Miles Waller

unread,
Nov 28, 2013, 4:53:15 PM11/28/13
to rhino-t...@googlegroups.com
Hi

It doesn't support what you are trying to do.  Two options:

Conventioninputcommandoperation has a method createrowfromreader.   You could use this to run a new query in c# for each row in the first query, and enumerate the output of this second query for consumption in the pipeline.

Otherwise you need to create your own version of inputcommandoperation that uses the enumerable given to it in the execute method to create a command for each item.  It would not be difficult.  Then the operations would chain together as you expect. 

Miles 

--
You received this message because you are subscribed to the Google Groups "Rhino Tools Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhino-tools-d...@googlegroups.com.
To post to this group, send email to rhino-t...@googlegroups.com.
Visit this group at http://groups.google.com/group/rhino-tools-dev.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages