[EXASOL-2924] Lua support for Virtual Schema Adapter Scripts Created: 08.07.2021  Updated: 13.01.2022  Resolved: 12.07.2021

Status: Resolved
Project: EXASOL Roadmap
Component/s: None
Fix Version/s: Exasol 7.1.0, Exasol 7.1.rc1

Type: New Feature Priority: Major
Reporter: Captain EXASOL Assignee: Captain EXASOL
Resolution: Fixed Votes: 0
Labels: None

Issue Links:



Virtual schemas allow virtually accessing external data sources. Virtual Schemas require Adapter Scripts, that can be implemented in Java and Python.

New Feature

Adapter scripts can now also be written in Lua. Such adapters have a much smaller runtime overhead and can execute local SELECT queries transaction-safe.

New SQL Syntax


New Lua API

Callback Function

The virtual schema callback function has the following signature in Lua:

function adapter_call(request_json)

The Lua CJSON library can be used for JSON handling, see EXASOL-2598.

Database Interaction

During the execution of the statements CREATE VIRTUAL SCHEMA, ALTER VIRTUAL SCHEMA, and DROP VIRTUAL SCHEMA (i.e., during the Virtual Schema API request types "createVirtualSchema", "refresh", "setProperties", and "dropVirtualSchema") the Lua adapter script can execute SQL statements. The statements run locally in the same transaction and session as the virtual schema statements. The API for this is similar to the query and pquery functions, but instead there are two new functions which are only available in Lua adapter scripts: exa.query_no_preprocessing and exa.pquery_no_preprocessing.

The following restrictions are enforced for these functions in Lua adapter scripts:

  • The queries always run with the privileges of the virtual schema owner.
  • No preprocessor script is used for the queries. This makes the queries safe from modification by the user of the virtual schema.
  • Only SELECT queries are allowed.
  • Not allowed in batch mode.
  • No query caching.

Generated at Fri Jan 28 23:27:52 CET 2022 using Jira 7.13.18#713018-sha1:e1230154f8ff8cc9272975bf568fc732e806fd68.