Materialized View Metadata API

This topic explains how to use the Materialized View Metadata API.

In this topic:

Introduction

The following endpoints enable you to manage the Materialized Views:

Parameters

Parameter Type Required? Description
tenantId Integer Yes ID of the tenant.
name String No Name of the Materialized View.
active Boolean Yes Metadata is kept but not data if its false.
materializedViewID String Yes ID of the Materialized View.
subQuery Object Yes MCPSQuery reference.
refreshMode Enum Yes

Possible Values :

  • ON_DEMAND

refreshType Enum Yes

Possible Values :

  • COMPLETE

stageCompletionTrigger Array of Strings No

Possible Values :

  • DW

  • ANALYTICS

  • DEDUPE

  • MERGE_AND_PROMOTION

scheduleRefreshTrigger Integer No [maxDelaySeconds: <number>], integer larger than 0.

Nested schema: subQuery

Parameter Type Required? Description
queryType Enum Yes

Possible Values :

  • mcpsQuery

value Object Yes MCPSQuery.

Nested schema: subQuery >value

Parameter Type Required? Description
MCPSQuery Object Yes Top object. Used to name and store the query. Contains a SetOperation defining the query.

Nested schema: subQuery > value > MCPSQuery

Parameter Type Required? Description
tenantId Integer Yes ID of the tenant.
name String No Name of the Query.
active Boolean Yes Metadata is kept but not data if its false.
uniqueId String Yes A unique ID for this object (per tenant).
operation Object Yes The SetOperation for this Query.
type Boolean Yes

Possible Values :

  • DW

Nested schema: subQuery > value > MCPSQuery> operation

Parameter Type Required? Description
ctype String Yes Must be set to .SetOperation.
name String No A name for this operation.
tenantId Integer Yes ID of the tenant.
uniqueId String Yes A unique ID for this object (per tenant).
operands Array of Strings Yes

1 or 2 SetOperands. A SetOperand is currently either a SetOperation, ObjectSet or ObjectSetReference.

operator Enum Yes

Possible Values :

  • INTERSECTION

  • UNION

  • EXCLUSION

distinct Boolean Yes

Whether or not the output of this query should return only distinct instances.

outputAttributes Array of Strings Yes

The attributes to return from this SetOperation. These attributes are raised and then available for upper-level parts of the query (for joins, or export).

joinConditions Array of Strings Yes

Pairs of 2 ReferenceAttributes to join the 2 operands. ReferenceAttributes used in a joinCondition must be exposed as outputAttributes in their respective SetOperation or ObjectSet.

Endpoints

Retrieving a List of Materialized Views

Use this endpoint to retrieve a list of all materialized views. Returns an array of materialized view IDs.

Request URL

GET /v1/{accesskey}/metadata/materializedviews

Response

A successful response returns a list of all materialized views.

[
  {
    "tenantId": 100066,
    "name": "CUST_EVENT_JOIN_DW",
    "versionTS": 1617778438412,
    "active": true,
    "createdTS": 1617778438412,
    "materializedViewID": "CUST_EVENT_JOIN_DW",
    "subQuery": {
      "queryType": "mcpsQuery",
      "value": {
        "MCPSQuery": {
          "tenantId": 0,
          "name": "test_join",
          "active": true,
          "uniqueId": "test_join",
          "operation": {
            "ctype": ".SetOperation",
            "name": "test_join_op",
            "tenantId": 0,
            "uniqueId": "test_join_op",
            "operands": [
              {
                "ctype": ".ObjectSet",
                "tenantId": 0,
                "name": "C1",
                "description": "C1",
                "objectName": "Customer",
                "uniqueId": "test_join_op_c1",
                "outputAttributes": [
                  {
                    "atype": ".ReferenceAttribute",
                    "tableName": "C1",
                    "attributeName": "ID"
                  }
                ],
                "distinct": false,
                "objectJoin": {
                  "type": "LEFT_OUTER",
                  "condition": [
                    {
                      "left": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "C1",
                        "attributeName": "ID"
                      },
                      "right": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      }
                    }
                  ],
                  "targetSet": {
                    "ctype": ".ObjectSet",
                    "tenantId": 0,
                    "name": "E1",
                    "description": "E1",
                    "objectName": "Event",
                    "uniqueId": "test_join_op_e1",
                    "outputAttributes": [
                      {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      }
                    ],
                    "distinct": false,
                    "criteria": {
                      "ctype": ".Criteria",
                      "operator": "AND",
                      "operands": [
                        {
                          "ctype": ".Criteria",
                          "operator": "EQUALS",
                          "operands": [
                            {
                              "ctype": ".ReferenceAttribute",
                              "tableName": "E1",
                              "attributeName": "Type"
                            },
                            {
                              "ctype": ".StaticAttribute",
                              "data": "AddToCart"
                            }
                          ]
                        },
                        {
                          "ctype": ".Criteria",
                          "operator": "BETWEEN",
                          "operands": [
                            {
                              "ctype": ".ReferenceAttribute",
                              "tableName": "E1",
                              "attributeName": "EventTS"
                            },
                            {
                              "ctype": ".ParameterValue",
                              "identifier": "startWindow"
                            },
                            {
                              "ctype": ".ParameterValue",
                              "identifier": "endWindow"
                            }
                          ]
                        }
                      ]
                    },
                    "occurrence": {
                      "type": "LAST",
                      "partitionAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      },
                      "limit": 1,
                      "count": 5,
                      "orderAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "EventTS"
                      }
                    },
                    "parameters": [
                      {
                        "identifier": "startWindow",
                        "type": "TIMESTAMP",
                        "data": {
                          "ctype": ".StaticAttribute",
                          "data": 1422748800000
                        }
                      },
                      {
                        "identifier": "endWindow",
                        "type": "TIMESTAMP",
                        "data": {
                          "ctype": ".StaticAttribute",
                          "data": 1448928000000
                        }
                      }
                    ]
                  }
                }
              },
              {
                "ctype": ".ObjectSet",
                "tenantId": 0,
                "name": "C2",
                "description": "C2",
                "objectName": "Customer",
                "uniqueId": "test_join_op_c2",
                "outputAttributes": [
                  {
                    "atype": ".ReferenceAttribute",
                    "tableName": "C2",
                    "attributeName": "ID"
                  }
                ],
                "distinct": false,
                "objectJoin": {
                  "type": "LEFT_OUTER",
                  "condition": [
                    {
                      "left": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "C2",
                        "attributeName": "ID"
                      },
                      "right": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      }
                    }
                  ],
                  "targetSet": {
                    "ctype": ".ObjectSet",
                    "tenantId": 0,
                    "name": "E2",
                    "description": "E2",
                    "objectName": "Event",
                    "uniqueId": "test_join_op_e2",
                    "outputAttributes": [
                      {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      }
                    ],
                    "distinct": false,
                    "occurrence": {
                      "type": "LAST",
                      "partitionAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      },
                      "limit": 1,
                      "count": 1,
                      "orderAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "EventTS"
                      }
                    }
                  }
                }
              }
            ],
            "operator": "EXCLUSION",
            "distinct": false,
            "outputAttributes": [
              {
                "atype": ".ReferenceAttribute",
                "tableName": "C1",
                "attributeName": "ID"
              }
            ],
            "joinConditions": [
              {
                "left": {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                },
                "right": {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C2",
                  "attributeName": "ID"
                }
              }
            ]
          },
          "type": "DW"
        }
      }
    },
    "refreshMode": "ON_DEMAND",
    "refreshType": "COMPLETE",
    "scheduleRefreshTrigger": [
      {
        "maxDelaySeconds": 3600
      }
    ],
    "stageCompletionTrigger": [
      {
        "value": "DW"
      }
    ]
  },
  {
    "tenantId": 100066,
    "name": "CUST_ORDER_JOIN_DW",
    "versionTS": 1618234402174,
    "active": true,
    "createdTS": 1618234402174,
    "materializedViewID": "CUST_ORDER_JOIN_DW",
    "subQuery": {
      "queryType": "mcpsQuery",
      "value": {
        "MCPSQuery": {
          "tenantId": 100066,
          "name": "AB_CART",
          "versionTS": 1612888707031,
          "active": true,
          "lastModifiedBy": "mcps",
          "createdBy": "mcps",
          "createdTS": 1603374090309,
          "uniqueId": "abcart",
          "operation": {
            "ctype": ".SetOperation",
            "name": "AbCart",
            "tenantId": 10,
            "uniqueId": "abcart",
            "operands": [
              {
                "ctype": ".ObjectSet",
                "tenantId": 10,
                "name": "C1",
                "description": "C1",
                "objectName": "Customer",
                "uniqueId": "abcart_c1",
                "outputAttributes": [
                  {
                    "atype": ".ReferenceAttribute",
                    "tableName": "C1",
                    "attributeName": "ID"
                  }
                ],
                "distinct": false,
                "objectJoin": {
                  "type": "LEFT",
                  "condition": [
                    {
                      "left": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "C1",
                        "attributeName": "ID"
                      },
                      "right": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      }
                    }
                  ],
                  "targetSet": {
                    "ctype": ".ObjectSet",
                    "tenantId": 10,
                    "name": "E1",
                    "description": "E1",
                    "objectName": "Event",
                    "uniqueId": "abcart_e1",
                    "outputAttributes": [
                      {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      }
                    ],
                    "distinct": false,
                    "criteria": {
                      "ctype": ".Criteria",
                      "operator": "AND",
                      "operands": [
                        {
                          "ctype": ".Criteria",
                          "operator": "EQUALS",
                          "operands": [
                            {
                              "ctype": ".ReferenceAttribute",
                              "tableName": "E1",
                              "attributeName": "Type"
                            },
                            {
                              "ctype": ".StaticAttribute",
                              "data": "AddToCart"
                            }
                          ]
                        },
                        {
                          "ctype": ".Criteria",
                          "operator": "BETWEEN",
                          "operands": [
                            {
                              "ctype": ".ReferenceAttribute",
                              "tableName": "E1",
                              "attributeName": "EventTS"
                            },
                            {
                              "ctype": ".ParameterValue",
                              "identifier": "startWindow"
                            },
                            {
                              "ctype": ".ParameterValue",
                              "identifier": "endWindow"
                            }
                          ]
                        }
                      ]
                    },
                    "occurrence": {
                      "type": "LAST",
                      "partitionAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "CustomerID"
                      },
                      "limit": 1,
                      "count": 5,
                      "orderAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E1",
                        "attributeName": "EventTS"
                      }
                    },
                    "parameters": [
                      {
                        "identifier": "startWindow",
                        "type": "TIMESTAMP",
                        "data": {
                          "ctype": ".StaticAttribute",
                          "data": 1422748800000
                        }
                      },
                      {
                        "identifier": "endWindow",
                        "type": "TIMESTAMP",
                        "data": {
                          "ctype": ".StaticAttribute",
                          "data": 1448928000000
                        }
                      }
                    ]
                  }
                }
              },
              {
                "ctype": ".ObjectSet",
                "tenantId": 10,
                "name": "C2",
                "description": "C2",
                "objectName": "Customer",
                "uniqueId": "abcart_c2",
                "outputAttributes": [
                  {
                    "atype": ".ReferenceAttribute",
                    "tableName": "C2",
                    "attributeName": "ID"
                  }
                ],
                "distinct": false,
                "objectJoin": {
                  "type": "LEFT",
                  "condition": [
                    {
                      "left": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "C2",
                        "attributeName": "ID"
                      },
                      "right": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      }
                    }
                  ],
                  "targetSet": {
                    "ctype": ".ObjectSet",
                    "tenantId": 10,
                    "name": "E2",
                    "description": "E2",
                    "objectName": "Event",
                    "uniqueId": "abcart_e2",
                    "outputAttributes": [
                      {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      }
                    ],
                    "distinct": false,
                    "occurrence": {
                      "type": "LAST",
                      "partitionAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "CustomerID"
                      },
                      "limit": 1,
                      "count": 1,
                      "orderAttribute": {
                        "atype": ".ReferenceAttribute",
                        "tableName": "E2",
                        "attributeName": "EventTS"
                      }
                    }
                  }
                }
              }
            ],
            "operator": "EXCLUSION",
            "distinct": false,
            "outputAttributes": [
              {
                "atype": ".ReferenceAttribute",
                "tableName": "C1",
                "attributeName": "ID"
              }
            ],
            "joinConditions": [
              {
                "left": {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                },
                "right": {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C2",
                  "attributeName": "ID"
                }
              }
            ]
          },
          "type": "DW"
        }
      }
    },
    "refreshMode": "ON_DEMAND",
    "refreshType": "COMPLETE",
    "stageCompletionTrigger": [
      {
        "value": "DW"
      }
    ]
  }
]
        

Creating a Materialized View

Use this endpoint to create a materialized view.

Request URL

POST /v1/{accesskey}/metadata/materializedviews

Request Body

{
  "tenantId": 100066,
  "name": "CUST_ORDER_JOIN_DW",
  "versionTS": 1618234402174,
  "active": true,
  "createdTS": 1618234402174,
  "materializedViewID": "CUST_ORDER_JOIN_DW",
  "subQuery": {
    "queryType": "mcpsQuery",
    "value": {
      "MCPSQuery": {
        "tenantId": 100066,
        "name": "AB_CART",
        "versionTS": 1612888707031,
        "active": true,
        "lastModifiedBy": "mcps",
        "createdBy": "mcps",
        "createdTS": 1603374090309,
        "uniqueId": "abcart",
        "operation": {
          "ctype": ".SetOperation",
          "name": "AbCart",
          "tenantId": 10,
          "uniqueId": "abcart",
          "operands": [
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C1",
              "description": "C1",
              "objectName": "Customer",
              "uniqueId": "abcart_c1",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C1",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E1",
                  "description": "E1",
                  "objectName": "Event",
                  "uniqueId": "abcart_e1",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "criteria": {
                    "ctype": ".Criteria",
                    "operator": "AND",
                    "operands": [
                      {
                        "ctype": ".Criteria",
                        "operator": "EQUALS",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "Type"
                          },
                          {
                            "ctype": ".StaticAttribute",
                            "data": "AddToCart"
                          }
                        ]
                      },
                      {
                        "ctype": ".Criteria",
                        "operator": "BETWEEN",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "EventTS"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "startWindow"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "endWindow"
                          }
                        ]
                      }
                    ]
                  },
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 5,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "EventTS"
                    }
                  },
                  "parameters": [
                    {
                      "identifier": "startWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1422748800000
                      }
                    },
                    {
                      "identifier": "endWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1448928000000
                      }
                    }
                  ]
                }
              }
            },
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C2",
              "description": "C2",
              "objectName": "Customer",
              "uniqueId": "abcart_c2",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C2",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C2",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E2",
                  "description": "E2",
                  "objectName": "Event",
                  "uniqueId": "abcart_e2",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 1,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "EventTS"
                    }
                  }
                }
              }
            }
          ],
          "operator": "EXCLUSION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ID"
            }
          ],
          "joinConditions": [
            {
              "left": {
                "atype": ".ReferenceAttribute",
                "tableName": "C1",
                "attributeName": "ID"
              },
              "right": {
                "atype": ".ReferenceAttribute",
                "tableName": "C2",
                "attributeName": "ID"
              }
            }
          ]
        },
        "type": "DW"
      }
    }
  },
  "refreshMode": "ON_DEMAND",
  "refreshType": "COMPLETE",
  "stageCompletionTrigger": [
    {
      "value": "DW"
    }
  ]
}
        

Updating a Materialized View

Use this endpoint to update an existing materialized view, specified by the materialized view ID.

Request URL

PUT /v1/{accesskey}/metadata/materializedviews/{materializedViewID}

Request Body

{
  "tenantId": 100066,
  "name": "CUST_ORDER_JOIN_DW",
  "versionTS": 1618234402174,
  "active": true,
  "createdTS": 1618234402174,
  "materializedViewID": "CUST_ORDER_JOIN_DW",
  "subQuery": {
    "queryType": "mcpsQuery",
    "value": {
      "MCPSQuery": {
        "tenantId": 100066,
        "name": "AB_CART",
        "versionTS": 1612888707031,
        "active": true,
        "lastModifiedBy": "mcps",
        "createdBy": "mcps",
        "createdTS": 1603374090309,
        "uniqueId": "abcart",
        "operation": {
          "ctype": ".SetOperation",
          "name": "AbCart",
          "tenantId": 10,
          "uniqueId": "abcart",
          "operands": [
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C1",
              "description": "C1",
              "objectName": "Customer",
              "uniqueId": "abcart_c1",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C1",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E1",
                  "description": "E1",
                  "objectName": "Event",
                  "uniqueId": "abcart_e1",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "criteria": {
                    "ctype": ".Criteria",
                    "operator": "AND",
                    "operands": [
                      {
                        "ctype": ".Criteria",
                        "operator": "EQUALS",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "Type"
                          },
                          {
                            "ctype": ".StaticAttribute",
                            "data": "AddToCart"
                          }
                        ]
                      },
                      {
                        "ctype": ".Criteria",
                        "operator": "BETWEEN",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "EventTS"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "startWindow"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "endWindow"
                          }
                        ]
                      }
                    ]
                  },
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 5,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "EventTS"
                    }
                  },
                  "parameters": [
                    {
                      "identifier": "startWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1422748800000
                      }
                    },
                    {
                      "identifier": "endWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1448928000000
                      }
                    }
                  ]
                }
              }
            },
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C2",
              "description": "C2",
              "objectName": "Customer",
              "uniqueId": "abcart_c2",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C2",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C2",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E2",
                  "description": "E2",
                  "objectName": "Event",
                  "uniqueId": "abcart_e2",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 1,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "EventTS"
                    }
                  }
                }
              }
            }
          ],
          "operator": "EXCLUSION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ID"
            }
          ],
          "joinConditions": [
            {
              "left": {
                "atype": ".ReferenceAttribute",
                "tableName": "C1",
                "attributeName": "ID"
              },
              "right": {
                "atype": ".ReferenceAttribute",
                "tableName": "C2",
                "attributeName": "ID"
              }
            }
          ]
        },
        "type": "DW"
      }
    }
  },
  "refreshMode": "ON_DEMAND",
  "refreshType": "COMPLETE",
  "stageCompletionTrigger": [
    {
      "value": "DW"
    }
  ]
}
        

Retrieving a Materialized View

Use this endpoint to retrieve a specific materialzed view, specified by the materialized view ID.

Request URL

GET /v1/{accesskey}/metadata/materializedviews/{materializedViewID}

Response

A successful response returns details about the specified materialzed view.

{
  "tenantId": 100066,
  "name": "CUST_ORDER_JOIN_DW",
  "versionTS": 1618234402174,
  "active": true,
  "createdTS": 1618234402174,
  "materializedViewID": "CUST_ORDER_JOIN_DW",
  "subQuery": {
    "queryType": "mcpsQuery",
    "value": {
      "MCPSQuery": {
        "tenantId": 100066,
        "name": "AB_CART",
        "versionTS": 1612888707031,
        "active": true,
        "lastModifiedBy": "mcps",
        "createdBy": "mcps",
        "createdTS": 1603374090309,
        "uniqueId": "abcart",
        "operation": {
          "ctype": ".SetOperation",
          "name": "AbCart",
          "tenantId": 10,
          "uniqueId": "abcart",
          "operands": [
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C1",
              "description": "C1",
              "objectName": "Customer",
              "uniqueId": "abcart_c1",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C1",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C1",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E1",
                  "description": "E1",
                  "objectName": "Event",
                  "uniqueId": "abcart_e1",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "criteria": {
                    "ctype": ".Criteria",
                    "operator": "AND",
                    "operands": [
                      {
                        "ctype": ".Criteria",
                        "operator": "EQUALS",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "Type"
                          },
                          {
                            "ctype": ".StaticAttribute",
                            "data": "AddToCart"
                          }
                        ]
                      },
                      {
                        "ctype": ".Criteria",
                        "operator": "BETWEEN",
                        "operands": [
                          {
                            "ctype": ".ReferenceAttribute",
                            "tableName": "E1",
                            "attributeName": "EventTS"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "startWindow"
                          },
                          {
                            "ctype": ".ParameterValue",
                            "identifier": "endWindow"
                          }
                        ]
                      }
                    ]
                  },
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 5,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E1",
                      "attributeName": "EventTS"
                    }
                  },
                  "parameters": [
                    {
                      "identifier": "startWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1422748800000
                      }
                    },
                    {
                      "identifier": "endWindow",
                      "type": "TIMESTAMP",
                      "data": {
                        "ctype": ".StaticAttribute",
                        "data": 1448928000000
                      }
                    }
                  ]
                }
              }
            },
            {
              "ctype": ".ObjectSet",
              "tenantId": 10,
              "name": "C2",
              "description": "C2",
              "objectName": "Customer",
              "uniqueId": "abcart_c2",
              "outputAttributes": [
                {
                  "atype": ".ReferenceAttribute",
                  "tableName": "C2",
                  "attributeName": "ID"
                }
              ],
              "distinct": false,
              "objectJoin": {
                "type": "LEFT",
                "condition": [
                  {
                    "left": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "C2",
                      "attributeName": "ID"
                    },
                    "right": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  }
                ],
                "targetSet": {
                  "ctype": ".ObjectSet",
                  "tenantId": 10,
                  "name": "E2",
                  "description": "E2",
                  "objectName": "Event",
                  "uniqueId": "abcart_e2",
                  "outputAttributes": [
                    {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    }
                  ],
                  "distinct": false,
                  "occurrence": {
                    "type": "LAST",
                    "partitionAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "CustomerID"
                    },
                    "limit": 1,
                    "count": 1,
                    "orderAttribute": {
                      "atype": ".ReferenceAttribute",
                      "tableName": "E2",
                      "attributeName": "EventTS"
                    }
                  }
                }
              }
            }
          ],
          "operator": "EXCLUSION",
          "distinct": false,
          "outputAttributes": [
            {
              "atype": ".ReferenceAttribute",
              "tableName": "C1",
              "attributeName": "ID"
            }
          ],
          "joinConditions": [
            {
              "left": {
                "atype": ".ReferenceAttribute",
                "tableName": "C1",
                "attributeName": "ID"
              },
              "right": {
                "atype": ".ReferenceAttribute",
                "tableName": "C2",
                "attributeName": "ID"
              }
            }
          ]
        },
        "type": "DW"
      }
    }
  },
  "refreshMode": "ON_DEMAND",
  "refreshType": "COMPLETE",
  "stageCompletionTrigger": [
    {
      "value": "DW"
    }
  ]
}
        

Deleting a Materialized View

Use this endpoint to delete an existing materialized view, specified by the materialized view ID.

Request URL

DELETE /v1/{accesskey}/metadata/materializedviews/{materializedViewID}

Error codes

For successful responses, we get a 20x response code. In case of a failed response, we get one of the following error codes:

  • 401 : Unauthorized

  • 403 : Forbidden

  • 404 : Not Found

  • 422 : Unprocessable Entity (already exists, illegal input/parameter, invalid format/object)

  • 500 : Internal Error

Sample Error Response

{
  "errorMessage": "Invalid object: MaterializedView [CUST_ORDER_JOIN_DW] already exists",
  "httpstatus": "422"
}

Learn more

Materialized Views

Materialized View Refresh API