USER MANUALS

Creating Interface Views

Interface views are a special type of views that consist only of a definition of fields and a reference to another view. Interface views decouple the consumer of the view from the implementation of the view. The two main use cases are:

  • Contract-based development:

    • The client application and the manager of the project in Denodo agree on a view schema.

    • Afterwards, the team that develops the views in Denodo builds the implementation view for this interface view.

  • Data model abstraction:

    • Useful in projects that migrate the underlying data stores to the cloud but you want to make sure the view schema does not change.

When the Server executes a query that involves the interface, the query is delegated to the implementation view. Therefore, the operations that can be executed on an interface view (SELECT, INSERT, UPDATE or DELETE) are the same that can be performed on its implementation view.

The status of an interface view can be:

  • Ok: all the fields of the interface view have a valid “implementation expression”. The queries involving this view will work.

  • Without implementation: the interface was created without an implementation view or the implementation view has been deleted. The queries involving this view will fail.

  • Invalid: the interface has an implementation view, but some of the fields of the interface do not have an implementation expression or it is invalid. This may happen if you create an interface with an implementation view and later, the implementation is modified so the expressions are no longer valid. The queries involving this view will fail.

Consider this regarding the “source type properties” of the fields of an interface view (e.g. Type, Type size…):

  • The fields of the interface views may or may not define their own “source type properties”:

    • If in an interface view, a field does not have its own properties, Virtual DataPort propagates these properties from the implementation view to the interface view. Thus, if the implementation view changes, the properties of the fields of the interface view will change as well.

    • If in an interface view, a field defines its own property values, these will not be updated when the implementation view changes.

    For example, let us say we have an interface view “I_1” with a field called “f_1” of type “text”, without an explicit source type, and that in its implementation view, the source type of “f_1” is “VARCHAR” with length 15. If you query “I_1”, the type of “f_1” reported by the Denodo JDBC driver will be “VARCHAR(15)”.

    If you edit the implementation view and change the source type to “NVARCHAR”, the driver will report the type “NVARCHAR”. But if you leave the implementation view with “VARCHAR” and you edit the interface column to “NVARCHAR”, the driver will report “NVARCHAR” and future changes of the property in the implementation view will not be reflected on the interface.

  • Because of the above, to change the “source type properties” of a field, do it in the “Edit view” dialog of the implementation view and not in the interface view if you want to always propagate implementation values.

    See more about these properties and why are they useful in the section Viewing the Schema of a Base View.

  • If you use a view as a template to build an interface, by dropping the view on the “Definition” tab, all the field properties of the dropped view will be copied to the interface, that is, properties will be set explicitly at interface level.

When dropping a view used by the implementation of an interface or used directly as the implementation of an interface, the Administration Tool will warn that such interface will change to Without implementation status.


To create an interface view, click Interface on the File > New menu, or right-click on the Server Explorer and click Interface on the New menu. The definition of the interface will be populated with the fields of the selected view.

Creating a new interface view: “Definition” tab

Creating a new interface view: “Definition” tab

The Interface View wizard has three tabs:

  1. Definition: in this tab you can configure the definition of the view:

    1. Change the name of the interface view.

    2. Manage the name and type of the fields of the interface:

      1. If you want to base the definition of the interface on the schema of an existing view, drag a view to this tab; the existing schema will be replaced with the schema of the dragged view.

      2. To add a new field to the interface, click New field.

        In the box beside the name of the field, you can select the type of the field. By default, this box only contains the basic data types (int, float, text, etc.). If you want to select a compound field, select the Enable compound types check box.

      3. To delete a field from the interface, select its check box and click Remove selected.

      4. If you have deleted a field accidentally and you want to restore it, click Restore fields. The Tool will display the “Restore Fields” dialog where you have to select the fields that you want to add again to the interface view.

Creating a new interface view: “Implementation” tab

Creating a new interface view: “Implementation” tab

  1. Implementation: in this tab, you define how the fields of the interface view are mapped to the fields of the implementation view.

    First, you have to add an implementation view by dragging it from the Server Explorer. The implementation view can belong to a different database than the interface view.

    When adding the view, the fields with the same name are automatically linked. You can link the others by dragging a field of the definition to the field you want to link in the implementation view. Alternatively, enter a field name or an expression below, in the “Implementation Expression” column.

    In the figure Creating a new interface view: “Implementation” tab you can see the following:

    • A field can be mapped to a field of the implementation (ttime and taxid) or to a complex expression (summary).

      The implementation expressions must have the same type or compatible with the types of the definition. For example, if the interface has a field F_1 of type double, the implementation expression must have type double or a compatible type: int, long or float. If, for example, the field is type int, at runtime the values of this field are converted to the type of the interface, double.

    • The fields of an interface view that are mapped to a complex expression are not updateable. That is, INSERT, UPDATE or DELETE operations that involve these fields will fail.

    • The implementation view can have more fields than the definition. The extra fields are just ignored. In the figure Creating a new interface view: “Implementation” tab, the field “inc_type” of the implementation view is not mapped to any field of the definition.

    When there is an error in the interface view, this tab is marked with the icon image2 and a tooltip explaining the error. The possible reasons are:

    1. The interface view does not have implementation view.

    2. Some fields of the definition do not have an “Implementation expression”.

  2. Metadata: tab that allows you to define the folder where the interface will be stored and provide a description.

Add feedback