morazow / script-languages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EXASOL Script Languages

Build Status

Please note that this is an open source project which is officially supported by EXASOL. For any question, you can contact our support team.

Table of Contents

  1. About
  2. Prerequisites
  3. Quickstart

About

This project contains implementations for user defined functions (UDF's) that can be used in the EXASOL database (version 6.0.0 or later)

Prerequisites

In order to build this project, you need:

  • Linux or Mac OS X (experimental)
  • Docker

In order to follow the quickstart guide, you additionally need

  • Write-access to a bucket in a bucketfs in an EXASOL installation
  • curl
  • An SQL client connecting to the same EXASOL installation

For running the tests you also need

  • Python
  • GCC
  • Java
  • unixODBC
  • Docker with privileged mode

Quickstart

  1. Choose a flavor. Currently we have several pre-defined flavors available, e.g., mini-EXASOL-6.0.0, and standard-EXASOL-6.1.0. This project supports different versions of script language environments with different libraries and languages. We call these versions flavors. The pre-defined flavors can be modified and extended to create customized flavors. Each pre-defined flavor has its own set of Docker build-files in a corresponding subfolder of flavors.
  2. Create the language container. We choose to use the mini flavor which is the smallest of the currently available flavors and which only support the Python language.
$ ./build --flavor=mini-EXASOL-6.0.0

(on Mac OS X, use ./build -f mini-EXASOL-6.0.0)

  1. Export it into a standalone archive
$ ./export --flavor=mini-EXASOL-6.0.0

(on Mac OS X, use ./export -f mini-EXASOL-6.0.0) This creates the file mini-EXASOL-6.0.0.tar.gz.

Optionally, you can run some automated tests for your flavor by using

$ ./test_complete --flavor=mini-EXASOL-6.0.0

(on Mac OS X you need to have pip installed for this to work) If the test fails with the message

cp: cannot create regular file ‘/tmp/udftestdb/exa/etc/EXAConf’: Permission denied

then run stop_dockerdb and restart the test.

  1. Upload the file into bucketfs. For the following example we assume the password pwd and the bucketname funwithudfs in a bucketfs that is running on port 2580 on machine 192.168.122.158
curl -v -X PUT -T mini-EXASOL-6.0.0.tar.gz w:pwd@192.168.122.158:2580/funwithudfs/mini-EXASOL-6.0.0.tar.gz
  1. In SQL you activate the Python implementation of the flavor mini-EXASOL-6.0.0 by using a statement like this
ALTER SESSION SET SCRIPT_LANGUAGES='MYPYTHON=localzmq+protobuf:///bucketfsname/funwithudfs/mini-EXASOL-6.0.0?lang=python#buckets/bucketfsname/funwithudfs/mini-EXASOL-6.0.0/exaudf/exaudfclient';

Now the script language MYPYTHON can be used to define a script, e.g.,

CREATE SCHEMA S;
CREATE mypython SCALAR SCRIPT small_test() RETURNS DOUBLE AS
def run(ctx):
   return 1.2
/

The script can be executed as follows:

select small_test();
  1. Afterwards you may choose to remove the Docker images for this flavor. This can be done as follows:
./clean --flavor=mini-EXASOL-6.0.0

Please note that this script does not delete the Linux image that is used as basis for the images that were build in the previous steps.

About

License:MIT License


Languages

Language:Python 72.6%Language:C++ 16.5%Language:Java 3.5%Language:Shell 2.1%Language:PLSQL 1.8%Language:C 1.5%Language:PLpgSQL 0.7%Language:HTML 0.6%Language:R 0.5%Language:Makefile 0.1%