问题
Depending on business logic sometimes I need to change source table for my Customer dimension in Cube.
Previously I was changing structure of cube using the following code:
MyServerDataSourceView.Schema.Tables["DimCustomers"].ExtendedProperties["QueryDefinition"] = "new query";
MyServerDataSourceView.Update(); // update to new definition
DimCustomer.Process(ProcessType.ProcessAdd, EF);
MyServerDataSourceView.Schema.Tables["DimCustomers"].ExtendedProperties["QueryDefinition"] = "old regularquery";
MyServerDataSourceView.Update(); // revert back to old definition
But it is not trustful. Sometimes it doesn't revert back query definition.
Visual Studio shows that there is possibility to use queryBinding.
I was trying such code:
string queryAdd = "SELECT [a],[b],[c] FROM ase.newtable";
QueryBinding queryBinding = new QueryBinding();
queryBinding.QueryDefinition = queryAdd;
DimCustomer.Process(ProcessType.ProcessAdd, queryBinding);
And get the following error which doesn't say much:
Warning: 0x80019002 at ProcessAdd Customer Dimension - Sequence Container: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
I was trying to study Microsoft documentation but haven't found there any examples or clear explanation.
来源:https://stackoverflow.com/questions/51286842/amo-olap-querybinding