Creating Materialized Views
After executing a SQL Stream job, you can set up the Materialized Views to have a snapshot of your queried data. You can use the URL Pattern from the Materialized View to visualize the generated data.
- Make sure that PostgreSQL is installed and configured to SSB to create Materialized Views.
- You need to have a running SQL job on which you apply the Materialized Views configuration.
- Go to your cluster in Cloudera Manager.
- Click on SQL Stream Builder from the list of Services.
Click on SQLStreamBuilder Console.
The Streaming SQL Console opens up in a new window.
Run a SQL Stream job, and wait until data is shown on the results tab.
For more information on running a SQL job, see the Running a SQL Stream job documentation.
Select the Materialized View sub-tab on the Compose
Select a Primary Key.
If this list is empty, then no SQL is specified on the SQL sub-tab, or that SQL is invalid. Select a key as a primary key for the Materialized View. All data will be updated by this key.
Select a Retention Period.
Data not being mutated during this period will be removed from the view.
Enable or disable Recreate on Job Start.
If enabled, the Materialized View will be deleted when a job is started or restarted.
Enable or disable Ignore NULLS.
If enabled, NULL values will NOT update values that are non null - they will be ignored.
Select an API Key.
In case there are no API Keys, click Add API key, or click on Materialized Views from the main menu. The add API key window appears. Provide a name for the API key, and click Save Changes.To check your created API keys:
- Click on Materialized Views from the main
menu.The Materialized Views page appears.
- Click on [show] under Key to see the API Key.
- Click on Materialized Views from the main menu.
- Click on Apply Configuration.
Click on Add Query to create the Materialized View
The Materialized View Query Configuration window appears.
- Provide a name to the URL Pattern.
- Provide a description of the Materialized View Query, if needed.
Customize the Materialized View in the Query Builder.
- Select the columns of the SQL job you want to use in the Materialized View Query.
- Click on Add filters to apply computations and further enrichment of your data.
- Click on Add rule to save the filter.
Click Save Changes.
The Pattern URL appears under Materialized View Queries header.