【问题标题】:Need faster way to pull oData feed in SSIS需要更快的方法在 SSIS 中提取 oData 提要
【发布时间】:2012-12-05 22:57:54
【问题描述】:

有没有更快的方法来为 ssis 获取 oData?

public override void CreateNewOutputRows()
    {
        SomeEntities entities = new SomeEntities(new Uri("https://aurltomystuff.com/mywebservice.svc/"));
        string username = this.Variables.username;
        string domain = this.Variables.domain;
        string password = this.Variables.password;

        entities.Credentials = new NetworkCredential(username,password, domain);

        var tbl = from t in entities.AnEntitySetInMyService
                    select new
                    {
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField,
                        AField = t.AField 

                    };
        int pageSize = 500;
        int recordCount = this.Variables.recordCount;
        int page = 0;
        while (page * pageSize < recordCount)
        {
            if ((page + 1) * pageSize > recordCount) { recordCount = tbl.Count(); }

            foreach (var t in tbl.Skip(page * pageSize).Take(pageSize))
            {
                Output0Buffer.AddRow();
                Output0Buffer.AField = t.AField ;
                Output0Buffer.AField = t.AField ;
                if (t.AField == null) { Output0Buffer.AField_IsNull = true; } else { Output0Buffer.AField = (long)t.AField ; }
                if (t.AField == null) { Output0Buffer.AField_IsNull = true; } else { Output0Buffer.AField = (DateTime)t.AField; }
                Output0Buffer.AField = t.AField;
                Output0Buffer.AField = t.AField;

            }
            page++;
        }

    }

【问题讨论】:

  • 流回数据需要多长时间(将 SSIS 排除在外)?我假设这是您的最大吞吐量,除非您的 odata 提供程序允许您对调用进行分段(线程 1 拉取 1-1M 行,线程 2 覆盖 1M-2M 等)您期望接收多少行?您对速度的需求...您要解决的挑战是什么?第一批行到达管道的时间是否太长(后续批次正常)?

标签: c# ssis odata sql-server-2012 script-component


【解决方案1】:

我认为没有办法,开箱即用,更快地做到这一点。我的意思是,转换可以是同步的,例如您的示例,也可以是异步的。而且您的实施非常标准。但是,如果处理需要同步转换,您别无选择,如果它可以是异步的,您可以按照以下文章中的说明进行操作:http://msdn.microsoft.com/en-us/library/ms136133.aspx

希望有用。祝你好运!

【讨论】:

    【解决方案2】:

    尝试在 SSIS 中使用 oData 源。如果你只是拉数据,我认为它会更快。

    【讨论】:

    • 这没有提供问题的答案。一旦你有足够的reputation,你就可以comment on any post;相反,provide answers that don't require clarification from the asker。 - From Review
    • 我会恭敬地不同意您的评估。如果您以不同的视角阅读我所写的内容,您会发现我确实提供了答案。我说使用 oData 源而不是脚本,因为我相信它会更快。我认为您的评论是不必要的。
    • @J.D.Walker 澄清审稿人添加此评论的原因是因为您的回答听起来更像是评论。我建议您编辑您的答案以将其改写为听起来更像一个真实的答案(例如,包括一个如何使用“oData”执行此操作的小示例)。
    • @J.D.Walker 我认为问题在于措辞。它看起来像闲聊,而不像答案。答案应该看起来像实际答案,而不是另一个问题。
    • 正确。答案可能看起来不错,但更多的是评论 - 这是人们通常会如何呈现它。高质量的答案应该有更多的内容。不过,这是一个很接近的电话。
    猜你喜欢
    • 2019-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多