Code Monkey home page Code Monkey logo

exasol-driver-lua's Introduction

Exasol Driver for Lua

A LuaSQL driver for the Exasol database.

Build and test Lua project

Check out the user guide for more details.

Features

  1. Connect to an Exasol database and execute SQL statements
  2. Encrypted communication via TLS
  3. Compatible with the LuaSQL API
  4. Runs inside an Exasol user defined functions (UDF), see the user guide for details. Exasol 8 or later is required for this.

Information for Users

Dependencies

See the dependencies list for build and test dependencies and license information.

Information for Developers

Requirement, design documents and coverage tags are written in OpenFastTrace format.

exasol-driver-lua's People

Contributors

exadm-deg avatar kaklakariada avatar redcatbear avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exasol-driver-lua's Issues

Migrate comments to LuaDoc

To get consistent doc comments we should consistently use LuaDoc instead of EmmyDoc.
While EmmyDoc has better editor support in VSCode and IntelliJ, this differs between different VSCode plugins. Additionally it's not possible to generate HTML documentation from EmmyDoc.

That's why we need to migrate all comments to LuaDoc.

Acceptance Criteria

  • 1. Consistently use LuaDoc comments
  • 2. Update build to generate LuaDoc documentation
  • 3. Build must fail for invalid comments
  • 4. Publish on github pages: https://exasol.github.io/exasol-driver-lua/api/
  • 5. Add link from user guide to API doc

Known issues

Source links to classes in the API doc are broken. This will be fixed in #57

Upgrade to Exasol 8 once it is released

In #23 we added tests for running the driver inside an Exasol UDF. This requires an Exasol 8 docker-db.

Acceptance Criteria

Sporadic errors during websocket connection

Investigate sporadically failing integration tests: https://github.com/exasol/exasol-driver-lua/runs/5445284214?check_suite_focus=true

 Running test ./itest_cursor.lua
# XML output to /home/runner/work/exasol-driver-lua/exasol-driver-lua/target/luaunit-reports/itest_cursor.xml
# Started on Mon Mar  7 08:40:03 2022
# Starting class: TestCursor
# Starting test: TestCursor.test_closing_closed_cursor_succeeds
# Starting test: TestCursor.test_query_fails
# Starting test: TestCursor.test_select_multiple_columns_multiple_rows
#   Error:  ...river-lua/exasol-driver-lua/src/websocket_connection.lua:62: E-EDL-2: Did not receive response for payload. Username or password may be wrong.
# Starting test: TestCursor.test_select_multiple_columns_single_row
#   Error:  ...river-lua/exasol-driver-lua/src/websocket_connection.lua:62: E-EDL-2: Did not receive response for payload. Username or password may be wrong.
# Starting test: TestCursor.test_select_single_column_single_row
# Starting test: TestCursor.test_using_closed_cursor_fails
# Ran 6 tests in 0.239 seconds, 4 successes, 2 errors

Add integration test running in Exasol

To ensure that the driver runs inside an Exasol database we need to add integration tests.

Precondition: Exasol Docker container that includes dependencies.

Update ExaError

Situation

error-reporting-lua recently got a breaking overhaul to improve the object orientation it uses. The driver still uses the old exaerror instead of the new ExaError

Acceptance Criteria

  1. Error reporting ported to ExaError.

Verify consistent version numbers

Version numbers are specified in constants.lua and exasol-driver-lua-0.1.0-1.rockspec. We need to ensure they are equal in order to avoid confusion.

Rename root module

Currently all modules are located in the same namespace. To avoid polluting the global module namespace we need to move all modules to a sub-module, e.g. luasql.exasol.

Add integration test for very small fetch size

Fetching data requires specifying a fetch size in bytes.
We need to add an integration test to check what happens when a line does not fit into the given fetch size.
In case this results in an error we need to add appropriate error handling.

Add support for prepared statements

The Exasol WebSocket API supports prepared statements but the LuaSQL API has no interface for this.

We should extend the Connection class and add support for prepared statements with parameters.

Replace lunajson with lua-cjson

Currently we use lunajson, but lua-cjson is already available in Exasol.

Building lua-cjson on mac fails currently:

% luarocks install lua-cjson                 
Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock

lua-cjson 2.1.0.6-1 depends on lua >= 5.1 (5.4-1 provided by VM)
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/opt/lua/include/lua5.4 -c lua_cjson.c -o lua_cjson.o
lua_cjson.c:743:19: error: implicit declaration of function 'lua_objlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            len = lua_objlen(l, -1);
                  ^
1 error generated.

See mpx/lua-cjson#54 for a potential solution.

Root cause: mpx/lua-cjson#56

Workarounds: Install it with flag -DLUA_COMPAT_5_3

luarocks install lua-cjson --local "CFLAGS=-O3 -Wall -pedantic -DNDEBUG -DLUA_COMPAT_5_3"

or pin the version: "lua-cjson == 2.1.0" in rockspec.

Add support for cursor:fetch() mode "a"

See https://keplerproject.github.io/luasql/manual.html:

cur:fetch([table[,modestring]])
Retrieves the next row of results.
If fetch is called without parameters, the results will be returned directly to the caller. If fetch is called with a table, the results will be copied into the table and the changed table will be returned. In this case, an optional modestring parameter can be used. It is just a string indicating how the resulting table should be constructed. The mode string can contain:

"n"
    the resulting table will have numerical indices (default)
"a"
    the resulting table will have alphanumerical indices 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.