Skip to content

nsluis/cv2sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HANA Calculation View to SQL

This repo provides a script 'cv2sql' which converts graphical HANA Calculation Views to SQL. Each node is converted to a Common Table Expression (CTE) which is supported in most databases.

It is tested in both HANA and Databricks. With the option -d you can omit the specific HANA syntax regarding quotes around objects/fields.

The following node types are currently supported and tested:

  • Projection
  • Join
  • Non Equi Join
  • Aggregation
  • Union
  • Window Function
  • Rank
Usage: cv2sql [-h] (-v file | -p path) [-t] [-d]

Options:
  -h, --help  Show this help message and exit
  -v file     Convert a specific calculationview to SQL
  -p path     Convert all files with .hdbcalculationview extention
  -t          Generate a test query
  -d          Disable HANA double qoutes around object/field names

When the -t option is provided, a minus query is generated in both directions to be able to test if results between the original calculation view and the generated SQL are the same.

Testing

The sub repo in the tests folder is a HANA Cloud repository with 2 custom tables and a set of calculation views. Each node type has its own specific test model. There is also a model with the combination of all supported node types.

If you encounter any failed conversion, please send in the calculation view and I can have a look to see if I can add it. Please reach out to cv2sql@nsltech.nl

Todo

Some node types are not yet supported:

  • Minus
  • Intersect
  • Table Function

Other topics:

  • Parameters

About

HANA Calculation View to SQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages