Search code examples
ssasssas-tabular

How to clear then refresh database in one JSON block?


Currently I use the following JSON script to process our tabular cubes on the server (SSAS 2019)

{
  "refresh": {
    "type": "full",
    "objects": [
      {
        "database": "Cube1"
      }
    ]
  }
}

I want to clear and then process the database/cube, all in one JSON script/file.

However, when i execute below script in SSMS:

{
  "refresh": {
    "type": "clearValues",
    "objects": [
      {
        "database": "Cube1"
      }
    ]
  }
}
{
  "refresh": {
    "type": "full",
    "objects": [
      {
        "database": "Cube1"
      }
    ]
  }
}

I get this error:

The JSON DDL request failed with the following error: Additional text encountered after finished reading JSON content: {. Path '', line 11, position 1

I also tried including a comma between the different blocks to separate them but i get a similar error regardless.

So what is the correct way/syntax to combine these two JSON refresh blocks together in one script?


Solution

  • After some research, this can be achieved through sequential operation!!

    {
      "sequence": {
        "maxParallelism": 1,
        "operations": [
          {
            "refresh": {
              "type": "clearValues",
              "objects": [
                {
                  "database": "SomeCubeName"
                }
              ]
            }
          },
          {
            "refresh": {
              "type": "full",
              "objects": [
                {
                  "database": "SomeCubeName"
                }
              ]
            }
          }
        ]
      }
    }