Using Dynamic Materialized View Endpoints
You can use static or dynamic REST endpoints when creating Materialized Views in SQL Stream Builder. After setting filters for the Materialized View query, you can further filter down the results by using variables in the endpoint URL.
Difference between static and dynamic endpoints
When using a static endpoint, the endpoint URL serves as a constant string, the process of
filtering is constant and final. The results are displayed based on the configurations and
filters of the query. In case of a static endpoint, you provide the information in the
URL pattern field only with a reference purpose. For example, in the
following static endpoint the Filter is set to id greater than
0, and the endpoint URL is positive/id:
In case of a dynamic endpoint, you have the option to set dynamic variables in the endpoint
URL. This means that when providing the information in the URL pattern
field, you also include a generic variable that later can be specified when using the REST
endpoint. With dynamic endpoints, you can further filter the queried results based on the given
variable. When creating the dynamic endpoint, you need to make sure that the variable is
surrounded by curly braces to signal that it is a variable as minimumId in
the example shown below. You also need to reference the variable in the same way when setting
the Filters for the Materialized View Query. For example, in the
following dynamic endpoint the Filter is set to id greater than
{minimumId}, and the endpoint URL is
id/bigger/than/{minimumId}:
Using dynamic endpoints
You can use a static endpoint by clicking on it on the Materialized View page or by copying
the URL and pasting it to a browser, application or tool. As the endpoint is static, the URL can
be invoked and the aspect of filtering is constant. However, as a dynamic endpoint contains a
variable, you need to replace it by an actual value. This value makes the endpoint and the
filtering dynamic. In the following example, a static and dynamic endpoint is compared:
When you click on a dynamic endpoint, you are prompted to provide a value for the variable as
shown in the following illustration:
After entering a value, the filtered results are shown in a new browser tab:
The advantage of a dynamic endpoint is that by providing a variable in the URL, you are able
to narrow the queried results to the value you exactly need from that dataset. In the following
example, the minimumId variable is set to 5, so the "id" of the shown entries
are bigger than 5:
Using multiple variables in one endpoint
You can use multiple variables in a dynamic endpoint (/id/between/{minimumId}/{maximumId}), and you can also use the variables for different filters within a Materialized View query. In this case, the variables are replaced at every occasion by the same value you provide when using the dynamic endpoint.