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 SQL Stream Builder (SSB) to create Materialized Views.
Navigate to the Streaming SQL Console.
- Go to your cluster in Cloudera Manager.
- Select SQL Stream Builder from the list of services.
.The Streaming SQL Console opens in a new window.
Open a project from the Projects page of Streaming SQL
You are redirected to the Explorer view of the project.
- Select an already existing project from the list by clicking the Open button or Switch button.
- Create a new project by clicking the New Project button.
- Import a project by clicking the Import button.
- Click next to Jobs from the Explorer.
.The SQL Editor for the created job opens in a tab.
SELECTstatement to the SQL Editor.
Click Materialized View.
The configuration window for the Materialized View opens.
- Switch Enable MV toggle.
Enable or disable Recreate on Job Start.
If enabled, the Materialized View is 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 are ignored.
Select an API Key.
In case there are no API Keys, click Add API key, or click 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 API Keys from the Project Explorer, or click on the created API key under the API Keys. at the
Configure the Column Settings for the Materialized
Select a Primary Key.
If this list is empty, then no SQL is specified in the SQL Editor or the SQL query is invalid. Select a key as a primary key for the Materialized View. All data will be updated by this key.
- Enable Column Indexing if needed, and select the column by which you need the results to be indexed.
- Select a Primary Key.
Configure the retention time for the Materialized View.
For more information about how you can set the retention time, see the Configuring Retention Time for Materialized Viewsection.
Click New Endpoint to create the Materialized View
The Materialized View Endpoint window appears.
- Provide a name in the URL Pattern field.
- Provide a description of the Materialized View Query, if needed.
Customize the Materialized View in the Endpoint
Select the columns of the SQL job you want to use in the Materialized
You can select every column in the table by clicking on the Select All button.
Click Filters tab to apply computations and
further enrichment of your data.
Provide details of the filter by selecting the
Field, Operator and
You can add more rules or set a ruleset for the query.
- Select the columns of the SQL job you want to use in the Materialized View Query.
You can access the queried results by clicking Materialized Views from the Project Explorer, and by opening the URL pattern.at the