【发布时间】: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