简体   繁体   English

使用C#以编程方式填充SSAS数据挖掘结构

[英]Populate SSAS data mining structure programmatically with c#

Long time reader first time poster. 长期的读者第一次海报。

I am getting into SQL Server Analysis Services, but have been having great difficulty populating my newly created data mining structure. 我正在使用SQL Server Analysis Services,但是在填充新创建的数据挖掘结构时遇到了很大的困难。

I wish to work from my c# project which I am using as a central hub to control the learning. 我希望在我的c#项目中工作,我正在使用它作为中央枢纽来控制学习。 The data I wish to learn from is contained within a SQL Server database. 我希望从中学习的数据包含在SQL Server数据库中。

After creating an analysis services database in SSMS, I can create a mining structure - 在SSMS中创建分析服务数据库后,我可以创建一个挖掘结构-

CREATE MINING STRUCTURE [DON_TEST_000] ( [ID_NUM] LONG KEY, [TECK1] DOUBLE CONTINUOUS, [TECK2] DOUBLE CONTINUOUS ) WITH HOLDOUT(30 PERCENT) 创建具有保留状态(30%)的挖掘结构[DON_TEST_000]([ID_NUM]长键,[TECK1]双连续,[TECK2]双连续)

And then append my model - 然后附加我的模型-

ALTER MINING STRUCTURE [DON_TEST_000] ADD MINING MODEL [DON_TEST_000_MODEL0] USING Microsoft_Clustering 更改采矿结构[DON_TEST_000]使用Microsoft_Clustering添加采矿模型[DON_TEST_000_MODEL0]

Which seems to work okay. 似乎工作正常。 My problem is -> 我的问题是->

1) I wish to do this from my c# project, using ADOMD.NET. 1)我希望使用ADOMD.NET从我的c#项目中执行此操作。 I guess I can figure out how to create the SSAS database using this and execute the above queries. 我想我可以弄清楚如何使用它创建SSAS数据库并执行上述查询。

But more critically, 但更关键的是

2) I am unable to populate my mining structure with data at all - as the OPENQUERY (via INSERT) functionality requires a 'data source'. 2)我根本无法用数据填充挖掘结构-因为OPENQUERY(通过INSERT)功能需要“数据源”。 I have read on how to create this using Visual Studio, but I wish to do so programmatically from my c# project. 我已经阅读了有关如何使用Visual Studio创建此对象的信息,但是我希望通过c#项目以编程方式进行此操作。


Surely there is a way for me to get Sql Server data into an Sql Server Analysis Services database using c#. 我肯定有一种方法可以使用c#将Sql Server数据获取到Sql Server Analysis Services数据库中。 It would seem to be so easy! 这看起来是如此简单!


Thanks for any help, D 谢谢你的帮助,D

Not sure if I got you correctly but you can create/process SSAS databases, from normal SQL Jobs. 不知道我是否正确,但是您可以从常规SQL作业中创建/处理SSAS数据库。 You can write stored procedures which trigger these database jobs, and call them from within your c#.NET project. 您可以编写存储过程来触发这些数据库作业,并在c#.NET项目中调用它们。

You have to deploy from BIDS, but then to reprocess the cube you can have an SQL job executing XMLA 您必须从BIDS进行部署,但是要重新处理多维数据集,可以有一个执行XMLA的SQL作业。

For instance you would create a job named TestJob, and in your XMLA database job you would have something similar to this : 例如,您将创建一个名为TestJob的作业,在XMLA数据库作业中,您将具有类似于以下内容的内容:

<Batch xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
  <Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
    <Object>
      <DatabaseID>[Your SSAS Database]</DatabaseID>
    </Object>
    <Type>ProcessFull</Type>
    <WriteBackTableCreation>UseExisting</WriteBackTableCreation>
  </Process>
</Batch> 

And then you can use from C#.NET, EXEC msdb.dbo.sp_start_job 'TestJob' to run the reprocessing of the cube. 然后,您可以从C#.NET使用EXEC msdb.dbo.sp_start_job'TestJob'运行多维数据集的重新处理。

Not sure if that was what you are after. 不知道那是不是你所追求的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM