SQLSwimmer
SQLSwimmer

Reputation: 11

Getting an error when using TOM via PowerShell to process Power BI dataset

I am writing a PowerShell script to process a Power BI dataset using the TOM. This worked great when I needed to load data partition by partition. Now that all my data is loaded, I need to send a process Recalc command for the whole database. It seemed pretty straight forward, using the .Process() method and passing the ProcessRecalc param on the database object, however I am getting the following error and don't understand why.

Error processing '': process type 'ProcessRecalc'; Error: 'This command cannot be executed on database '' because it has been defined with StorageEngineUsed set to TabularMetadata. For databases in this mode, you must use Tabular APIs to administer the database.

I am confused because I am using the TOM to issue the command, just like I did for loading the data in the partitions. Googling this error has not been helpful. My model is set to compatibility level 1500 and I have verified that's what it is via SSMS.

Any insight would be appreciated.

Upvotes: 0

Views: 195

Answers (1)

SQLSwimmer
SQLSwimmer

Reputation: 11

Thanks to this post by post by Darren Gosbell, I discovered that this error happens because of a hodge-podge of different objects types in the TOM. Long story short:

Instead of using the .Process() method on the database object, you need to use the .RequestRefresh() (with the appropriately refresh type) against the model object, then the .SaveChanges() method to send the command.

Upvotes: 0

Related Questions