Best Practices for Migrating SQL queries to Denodo VQL

Applies to: Denodo 7.0 , Denodo 6.0 , Denodo 5.5 , Denodo 5.0
Last modified on: 02 Apr 2018
Tags: VQL JDBC data sources

Download document

Goal

This document lists some recommendations and good practices to migrate legacy SQL queries to Denodo VQL.  

Content

  • Use single quotes to surround literals replacing “ by  as indicated by the SQL standard.

  • The Knowledge Base article VDP Conformance with Standard SQL contains a reference of the Virtual DataPort conformance with the SQL 92 standard. The document is focused on query capabilities and contains information about Data Types, SQL Predicates support and SQL Functions support. The Query Expressions section lists the expressions defined by the standard SQL and their equivalent in Virtual DataPort, explaining the differences with the standard when appropriate.

  • Identify dialect differences in the transformation functions. There are some functions that need to be slightly translated to Denodo VQL. In many of these cases, the effort can be automated. For example, changing from Oracle’s LENGTH to Denodo VQL’s LEN only requires a “search and replace”. The same occurs if we need to modify from Teradata’s SUBSTRACT to Denodo VQL’s SUBTRACT. For a complete reference of VQL functions equivalent to functions in other database systems see:

  • Identify other differences in format, for example, the use of hard-coded dates. In this particular case, two options are available:
  • Modify the default date representation format in Denodo to match the original
  • Modify the queries to match Denodo’s default representation.        

The configuration of type date is detailed in the section “Creating New Internationalization Configurations, subsection Configuration of dates” of the Advanced VQL Guide.

  • Remove references to databases in the FROM clause. For example:

                

SELECT * FROM acme_crm.client;

should be rewritten as

SELECT * FROM client;

since in Virtual DataPort the base view is going to have a name without ‘.’

  • Use the “Create Base View From Query” option, if needed, to leverage the existing query syntax. Denodo can reuse those queries as subqueries to maximize query delegation. This is a very powerful feature that allows reusing complex queries already built, allows using database-proprietary functions or constructions (e.g. Teradata recursive queries) and it also allows invoking stored procedures for those databases where graphical introspection is not supported.

The Knowledge Base article Using the Create Base View From Query Option explains when and how to use this option. The limitations of this functionality are also explained.

  • Denodo’s library of transformations is extensible via plugins. This is useful, for instance, in cases where customers have their own custom functions in the underlying sources. Using the custom functions API, those can also be registered and used in Denodo. Further information can be found in section “Developing Custom Functions” of the Virtual DataPort Developer Guide.

  • Test the queries to verify their correct behavior. Denodo provides a powerful Testing Tool that can be downloaded from the Denodo Support Site, specially designed to handle migration scenarios. This tool will be extremely useful to verify scenarios with large amounts of queries in an automated fashion. The tool also generates HTML reports to easily identify erroneous queries.

Questions

Ask a question
You must sign in to ask a question. If you do not have an account, you can register here

Featured content

DENODO TRAINING

Ready for more? Great! We offer a comprehensive set of training courses, taught by our technical instructors in small, private groups for getting a full, in-depth guided training in the usage of the Denodo Platform. Check out our training courses.

Training