Using Custom Objects in ZappySys Drivers (Proc / View)

Introduction

ODBC PowerPack v1.2 release brought an interesting feature for all API drivers. New version gives you an ability to create Custom Objects. You can create parameterized Stored Procedure and Virtual Tables on the same Data Source (ODBC DSN or Data Gateway Data Source). For more information you see here

Custom Objects

There are mainly 3 types of custom objects you can create using ZappySys Drivers.

Custom Stored Procedure

You can create procedures to encapsulate custom logic and then only pass handful parameters rather than long SQL to execute your API call.

ZappySys ODBC Driver - Custom Objects - New Stored Procure

ZappySys ODBC Driver – Custom Objects – New Stored Procure

Stored Procedure with Parameters

Here is an example stored procedure for JSON Driver. You can insert Placeholders anywhere inside Proc Body. Read more about placeholders here

To call stored procedure from client app using below SQL. Must prefix EXEC proc_name [parameter values….]

Stored Procedure without Parameters

ZappySys ODBC Driver : Without Parameters

Using Functions in Stored Procedure

ZappySys provides many functions which can be used as placeholder anywhere inside Stored Proc code or in your SQL query for Driver

Example of simple function (No parameter)

Example of function with parameters

In below example we have invoked function after we replaced parameter. Our function FUN_TO_DATE has 2 parameters (actual date value and format we want to output). This way we can control replacement order

 

Virtual Table – Connection String Mode

ZappySys Drivers support flexible Query language so you can override Default Properties you configured on Data Source such as URL, Body. This way you dont have to create multiple Data Sources if you like to read data from multiple EndPoints. However not every application support supplying custom SQL to driver so you can only select Table from list returned from driver.

Many applications like MS Access, Informatica Designer wont give you option to specify custom SQL when you import Objects. In such case Virtual Table is very useful. You can create many Virtual Tables on the same Data Source (e.g. If you have 50 URLs with slight variations you can create virtual tables with just URL as Parameter setting.

All Virtual Tables will be listed along with Other Tables returned by your Data Source from Response.

 

ZappySys ODBC Driver - Custom Objects

 

Virtual Table – SQL Mode (v1.6 or higher)

Version 1.6+ introduced new mode to create Virtual Table. Now you can write custom SQL just like a View in Relational DB.

See below example

ZappySys ODBC Driver - Custom Objects

Virtual Table Use Cases

Now lets look at a few real world use cases where Virtual Tables might be useful. You can use when your Client Application doesn’t have support to connect to ODBC in SQL Query mode and only allows Table selection / import.

MS Access – Import Tables

If you are using ZappySys ODBC Driver to integrate API in MS Access then Virtual Tables are useful because MS Access only allows to choose Tables when you import and no place to enter custom Query.

Importing Virtual Tables in MS Access (JSON REST API Example)

Importing Virtual Tables in MS Access (JSON REST API Example)

Informatica – Import Tables (Create Source / Target Schema from ODBC DSN)

Here is another use case of informatica rest / json api integration. Informatica doesnt allow to import SQL Query structure so you must choose exposed tables. Using Virtual Tables feature you can import multiple tables from Same ODBC DSN

Select JSON Source Table in Informatica Mapping Designer (JSON file or REST API)

Select JSON Source Table in Informatica Mapping Designer (JSON file or REST API)

Preview Data

Once virtual tables are defined you can go to preview tab and it will show entries there regardless your Data Source settings on main UI.

Query Virtual Table - Preview Data

Query Virtual Table – Preview Data

Troubleshooting Errors

While running in Access\Excel\other and reading data from DSN created with ODBC PowerPack, if you get this error "License type [ODBC_PP_TRIAL] not found or its expired"

Please refer to this article for the same:  Troubleshooting "License type [ODBC_PP_TRIAL] not found or its expired" error in Microsoft Access

Posted in ODBC PowerPack and tagged , , .