none
ProcessAdd using AMO SQL 2016 "System.NotImplementedException"

    Question

  • Recently upgraded from SQL 2014 to SQL 2016. We use AMO to perform regular ProcessAdd operations on our SSAS databases.

    After modifying the code to add a reference to "Microsoft.AnalysisServices.Core" I get a "NotImplementedException" when performing the ProcessAdd.

    It looks like ProcessAdd has been deprecated? And the only option is to go back to SQL 2014

    Here is some sample code:

                var Svr = new Server();
                Svr.Connect("Data Source=.;Provider=MSOLAP.6;Integrated Security=SSPI;Impersonation Level=Impersonate;");
                var Db = Svr.Databases.FindByName("AdventureWorksDW2014Multidimensional-EE");
                var cube = Db.Cubes.FindByName("Adventure Works");
    
                var measureGroup = cube.MeasureGroups.FindByName("Sales Orders");
    
                foreach (Partition partition in measureGroup.Partitions)
                {
                    QueryBinding queryBinding = (QueryBinding)partition.Source;
                    partition.Process(ProcessType.ProcessAdd, queryBinding);
                }


    {System.NotImplementedException: The method or operation is not implemented.

       at Microsoft.AnalysisServices.Core.AnalysisServicesClient.WriteProcess(XmlWriter output, IMajorObject obj, ProcessType type, IBinding source, ErrorConfiguration errorConfig, WriteBackTableCreation writebackOption, JaXmlSerializer serializer)
       at Microsoft.AnalysisServices.Core.AnalysisServicesClient.Process(IMajorObject obj, ProcessType type, IBinding source, ErrorConfiguration errorConfig, WriteBackTableCreation writebackOption, ImpactDetailCollection impact, XmlaWarningCollection warnings, JaXmlSerializer serializer)
       at Microsoft.AnalysisServices.Core.Server.Process(IMajorObject obj, ProcessType processType, IBinding source, ErrorConfiguration errorConfig, WriteBackTableCreation writebackOption, XmlaWarningCollection warnings, ImpactDetailCollection impactResult, Boolean analyzeImpactOnly)
       at Microsoft.AnalysisServices.Core.Server.SendProcess(IMajorObject obj, ProcessType processType, IBinding source, ErrorConfiguration errorConfig, WriteBackTableCreation writebackOption, XmlaWarningCollection warnings, ImpactDetailCollection impactResult, Boolean analyzeImpactOnly)
       at Microsoft.AnalysisServices.ProcessableMajorObject.Process(ProcessType type, IBinding source)
       at ConsoleApplication1.Program.Main(String[] args) in C:\Users\richardk\Desktop\Dump\ConsoleApplication1\Program.cs:line 30
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()}

    Monday, September 12, 2016 12:23 AM

Answers

  • I'd say this is definitely a bug. Using Reflector I can see that it's checking if the binding implements IQueryBinding (which the built-in QueryBinding object does not). I've posted this as a connect bug here https://connect.microsoft.com/SQLServer/feedback/details/3110077 

    I've also figured out a workaround which is that you can create a class in your own project which does implement IQueryBinding and then pass that in.

    eg.

    public class MyBinding : Microsoft.AnalysisServices.Core.IQueryBinding
        {
            public MyBinding(string dataSourceID, string queryDefinition)
            {
                DataSourceID = dataSourceID;
                QueryDefinition = queryDefinition;
            }
            public string DataSourceID { get; set; }
            public string QueryDefinition { get; set; }
            public ISite Site { get; set; }
            public event EventHandler Disposed;
            public void Dispose() { }
        }

    which you would use as follows:

    var qb = new MyBinding("Adventure Works DW", "SELECT * FROM table");
    partition.Process(ProcessType.ProcessAdd, qb);


    http://darren.gosbell.com - please mark correct answers

    • Marked as answer by Richard Kong Wednesday, November 02, 2016 11:44 AM
    Wednesday, November 02, 2016 6:17 AM
    Moderator

All replies

  • Hello Richard,

    See ProcessType Enumeration => ProcessAdd => "Performs an incremental update. Can be used for dimensions and partitions", but not for complete measure groups. Even in SSMS / SSDT you can not "Process Add" for a measure group.


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Monday, September 12, 2016 4:29 AM
  • I am doing a ProcessAdd on a partition not a measure group.

    I have reverted the sdk version back to SQL 2014 and the code works as is. 

    Monday, September 12, 2016 4:31 AM
  • Another option to is write your own function that generates the XMLA and then looks in the result set returned for errors
    Tuesday, November 01, 2016 2:41 PM
  • I'd say this is definitely a bug. Using Reflector I can see that it's checking if the binding implements IQueryBinding (which the built-in QueryBinding object does not). I've posted this as a connect bug here https://connect.microsoft.com/SQLServer/feedback/details/3110077 

    I've also figured out a workaround which is that you can create a class in your own project which does implement IQueryBinding and then pass that in.

    eg.

    public class MyBinding : Microsoft.AnalysisServices.Core.IQueryBinding
        {
            public MyBinding(string dataSourceID, string queryDefinition)
            {
                DataSourceID = dataSourceID;
                QueryDefinition = queryDefinition;
            }
            public string DataSourceID { get; set; }
            public string QueryDefinition { get; set; }
            public ISite Site { get; set; }
            public event EventHandler Disposed;
            public void Dispose() { }
        }

    which you would use as follows:

    var qb = new MyBinding("Adventure Works DW", "SELECT * FROM table");
    partition.Process(ProcessType.ProcessAdd, qb);


    http://darren.gosbell.com - please mark correct answers

    • Marked as answer by Richard Kong Wednesday, November 02, 2016 11:44 AM
    Wednesday, November 02, 2016 6:17 AM
    Moderator
  • Thanks Darren, that is a better solution than generating and executing the XMLA
    Wednesday, November 02, 2016 9:07 AM
  • Cool, I also touched bases with a contact on the product team and this is an issue they are aware of and they do hope to have a proper fix out soon.

    http://darren.gosbell.com - please mark correct answers

    Wednesday, November 02, 2016 11:43 AM
    Moderator