0

So is it possible to import data from ms sql to tabular model ssas using .net library adom.net? For now I know it is possible using wizard of data import, but maybe there is possible to do it without using wizard, but making with .net?

2
  • 1
    You can't push data into a tabular model. You can only connect to the server and tell it to "process" (pull data). See if this helps.... it's not a very helpful question but it should give you a rough idea stackoverflow.com/questions/24575563/… Commented May 9, 2019 at 10:11
  • Are you trying to add a data source to an existing model? Commented May 13, 2019 at 14:23

1 Answer 1

1

I'm not sure whether you are trying to do a data refresh or add a whole new datasource to your model. However, either one is fairly straightforward with the .net libraries.

    static void Main(string[] args)
    {
        Server server = new Server();

        server.Connect("Data source=YourSSASServerName;Timeout=7200000;Integrated Security=SSPI");

        Database database = server.Databases.FindByName("YourCubeDBName");

        //
        //process database (load in fresh data from SQL)
        //
        database.Process(ProcessType.ProcessFull);





        //
        // add new data source to model (SQL server)
        //
        database.Model.DataSources.Add(new ProviderDataSource()
        {
            Name = "SQL Server Data Source Example",
            Description = "A data source definition that uses explicit Windows credentials for authentication against SQL Server.",
            ConnectionString = "Provider=SQLNCLI11;Data Source=localhost;Initial Catalog=AdventureWorks2014;Integrated Security=SSPI;Persist Security Info=false",
            ImpersonationMode = Microsoft.AnalysisServices.Tabular.ImpersonationMode.ImpersonateAccount,
            Account = @".\Administrator",
            Password = "P@ssw0rd",
        });


        // 
        // Add the new database object to the server's  
        // Databases connection and submit the changes 
        // with full expansion to the server. 
        // 
        server.Databases.Add(database);
        database.Update(UpdateOptions.ExpandFull);
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.