Working with Views

Objective

After completing this lesson, you will be able to use views in SAP Datasphere

Views

Let's explore the possibilities with views in SAP Datasphere, using graphical views and SQL views.

Graphical Views

The figure shows a screenshot of a Graphical View in the Data Builder with a projection, filter and function.

In SAP Datasphere, you can use the graphical view editor in the Data Builder to create a view in an intuitive graphical interface. You can combine remote, replicated or local tables using joins or unions, use a projection to remove columns, filter data, add calculations, aggregate data, use input parameters, and specify other aspects of your output structure in the output node.

Data preview and SQL preview are available at each node (for example projection, filter, function, and aggregation).

It is recommended to filter as early as possible to avoid large result sets. You can analyze the performance of a view with the Runtime Metrics option on the toolbar. It's also possible to create and schedule view persistence if needed.

The figure shows a screenshot of selecting a source for a graphical view: objects using the repository and sources folder.

As a source for the view, you can select from existing objects in the repository (all tables and views available in your space or shared from other spaces) or create a source object using the predefined connections in your space.

You can create views with the following semantic usage:

  • Dimension
  • Text
  • Hierarchy
  • Hierarchy with directory
  • Relational dataset
  • Analytical dataset (deprecated)
The figure shows a screenshot of the definition of measures and attributes when creating a Graphical View: it shows the possible semantic types for attribute CURRENCY_CODE.

The output structure is built with attributes and/or measures.

You can specify Semantic Types for fields to identify the type of data in your columns (attributes and measures). This property defines the contents of a column, for example a value, a quantity, a date, geo or textual information, or another kind of semantic information. Semantic types are used by the core engines for data processing, analytics, and data consumption.

When you create a join in a view, you are immediately combining the data from the two sources based on the definition of the join mapping. In contrast, creating an association will merely prepare the conditions for performing a join in the future. A join is a one-time operation, while an association can be used to do any number of joins in different contexts.

You can create an association from any table or view to any other table or view at any level of the data layer, but they are required when defining the semantic relationships between facts, dimensions, text entities, and hierarchies. Since associations need to identify specific records in the entities they point to, they generally require key columns to be set in either or both entities in the relationship.

A view can be set to Exposed for Consumption to make it available for consumption in SAP Analytics Cloud, in other analytic clients, in ETL and other tools. Only views that have the Exposed for Consumption switch enabled can be accessed outside the space. SAP Analytics Cloud can access dimensions and other entities to which your analytical dataset points via associations, even if they have not themselves been exposed. Other analytics clients can consume views of any type that have the Exposed for Consumption switch enabled.

Note

It is recommended to expose the view data via analytic models.

You can define data access control on your view for data authorization.

Create a Graphical View

In this simulation, you will create a graphical view.

SQL Views

The figure shows a screenshot of creating a SQL View.

In addition to the graphical model environment, SAP Datasphere also provides a powerful SQL editor. You can choose between writing a standard SQL query using SELECT statements and operators such as JOIN and UNION, or use SQL Script to produce a table function. You can drag sources from the Source Browser, and specify measures and other aspects of your output structure in the side panel.