SAP HANA: using SQL for graphical views’ analysis

Home / SAP HANA / SAP HANA: using SQL for graphical views’ analysis

In general, SAP HANA’s objects can be built using two different approaches:

  • SQL language (SQL views, table functions, procedures);
  • Graphical Blocks (graphical calculation views).

Usage of graphical calculation views has some advantages (comparing to SQL objects): they are easier to maintain, the flow is more obvious and easy to understand, additionally it’s more convenient to change them and it’s very simple to show data in the intermediate steps (data preview option).

On the other hand, using SQL objects gives the ability for an easy extension of the code in the console – you can always take part of SQL code, copy it to the console, modify, run and check the results.

Fortunately, the same approach can be used together with graphical view – there is an SQL object behind every block in graphical view (projection, aggregation, join, union). You can put its name in the SQL console and write a query.

How to start?

When you need to write SQL for the final step of graphical view – just right click on the view and select Generate Select SQL. The SQL Console will open, with all columns in select clause.

If you need to write a SQL query for any intermediate step (join, projection etc.), first you need to find SQL name for this step. Right click on the block of your interest, select Data Preview.

After you run data preview, click Show Log button.

You will see the SQL code for your data preview.

Double click in Generated SQL line to show log entry details. You will see SQL’s name of the graphical component (after FROM).

Copy SQL, open SQL console and that’s it – you can write your query and adopt intermediate objects from graphical views, join them with tables or another view, check aggregated values for measures and many more functions.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *