Configure database views

Database views allow designers to create physical views derived from a model. These views are designed in this model and deployed in the hub schema, where they can be consumed:

  • By external applications for downstream analysis and access to the data.

  • By Dashboard Builder queries.

Database view definition

A database view is a configuration object that is defined with:

  • A base entity.

  • A view type that defines the scope of data returned by the physical view.

  • An optional SemQL condition to filter the content of the view.

  • A physical name that will be used to access the view.

  • A list of columns configured with:

    • An alias.

    • A SemQL expression that defines the value.

Create a database view

To create a database view:

  1. Right-click the Database Views node and select Add Database View.
    The Create New Database View wizard opens.

  2. In the Create New Database View wizard, enter the following values:

    • Name: internal name of the object.

    • Label: business-friendly name of the object.

    • Entity: select the entity at the root of the database view.

    • View Type: select the type of data to access (see View types).

      Not all view types are available for database views. For example, views bound to loads and batches are not listed.

    • Physical Name: name of the generated physical view.

  3. Click Next.
    In the second wizard step, provide the Filter condition applied to retrieve the data.

  4. Click Next.
    In the third wizard step, select the columns amongst the list of attributes from the entity you selected in the first step.

  5. Click Finish to close the wizard.
    The Database View editor opens.

  6. Optionally add or customize Columns.

  7. Enter an optional Description.

  8. Press Control+S (or Command+S on macOS) to save the editor.

Create a database view from another model object

Alternatively, database views can be created:

  • From a named query: the database view will be initialized with the SemQL filter and object properties of the named query.

  • From a form: each field in the form will convert to a view column.

  • From a collection: each column in the collection will convert to a view column.

Variables are not supported in SemQL expressions used for filters and columns within database views. Any filter or column having variables in its SemQL expression will be ignored when the database view is deployed.

Create a database view from a named query

To create a database view based on a named query:

  1. Right-click the named query you want to use under the Named Queries node of the Model Design view, and then select Create Database View.
    The Database View editor opens, pre-filled with:

    • Name: initialized with the name of the selected named query.

    • Label: initialized with the label of the selected named query.

    • Entity: populated with the root entity of the named query.

    • View Type: initialized with golden data (see View types).

    • Filter: initialized with the filter of the selected named query.

    • Columns: initialized with all object properties from the named query.

  2. Modify any property as required.

  3. Enter an optional Description.

  4. Press Control+S (or Command+S on macOS) to save the editor.

Create a database view from a form

To create a database view based on a form:

  1. Right-click the form you want to use in the Model Design view, and then select Create Database View.
    The Database View editor opens, pre-filled with:

    • Name: initialized with the name of the selected form.

    • Label: initialized with the label of the selected form.

    • Entity: populated with the entity of the form.

    • View Type: initialized with golden fata (see View types).

    • Columns: initialized with all form fields.

  2. Modify any property as required.

  3. Enter an optional SemQL Filter.

  4. Enter an optional Description.

  5. Press Control+S (or Command+S on macOS) to save the editor.

Create a database view from a collection

To create a database view based on a collection:

  1. Right-click the collection you want to use in the Model Design view, and then select Create Database View.
    The Database View editor opens, pre-filled with:

    • Name: initialized with the name of the selected collection.

    • Label: initialized with the label of the selected collection.

    • Entity: populated with the entity of the collection.

    • View Type: initialized with golden data (see View types).

    • Columns: initialized with all collection columns:

  2. Modify any property as required.

  3. Enter an optional SemQL Filter.

  4. Enter an optional Description.

  5. Press Control+S (or Command+S on macOS) to save the editor.

Deploy database views

When a model edition is deployed, a physical view named DBV_<physical view name> is generated in the schema location for each database view configured in the model. This view is composed of the list of columns defined on the corresponding database view and returns data as per the configured entity, view type, and SemQL filter.

Deploying on Oracle requires to grant view creation privileges to the database user configured for the data location’s datasource.

GRANT CREATE VIEW TO <user>