Installing madIS

The requirements for using madIS are:

  1. Python 2.6.x or 2.7.x: You can download a windows distribution of Python from http://www.python.org/download/releases/ .You need to download the latest Python in the 2.6 or 2.7 series. madIS doesn’t currently work with Python 3.0.

Note

Most Linux distributions come with Python 2.6 or Python 2.7 preinstalled.

  1. APSW:

    Windows:

    Download the windows distribution of APSW from http://code.google.com/p/apsw/downloads/list .

    Linux:

    Most Linux distributions contain in their repositories a sufficiently recent version of APSW. If you use Ubuntu 10.04 and later, install the python-apsw package:

    sudo apt-get install python-apsw
    

    In case APSW is not provided with your Linux distribution of choise, APSW should be build from source. The detailed instructions for building APSW can be found at:

    http://apidoc.apsw.googlecode.com/hg/build.html#recommended

    A quick command line to build and install APSW is:

    sudo python setup.py fetch --all --missing-checksum-ok build install
    

    If you are using Ubuntu and wish to build APSW from source, you also need the packages:

    build-essential libreadline5-dev zlib1g-dev python-dev
    

    MacOS:

    On MacOS 10.6 install APSW and readline via easy_install:

    easy_install apsw
    easy_install readline
    

    On MacOS 10.7 you have to build APSW from source (as showed above), for which you’ll also need Xcode.

    After building APSW, install readline via easy_install:

    sudo easy_install readline
    
  2. Download the madIS from:

    https://github.com/madgik/madis

  3. Use madis terminal by entering into the new “madis/” path and executing “python mterm.py [dbfile.db]”. When a database file is not given madis opens a database in memory.

  4. Use “cat data | python mexec.py -f script.sql [-d/-w dbfile.db]” to run a madis sql script on data from standard input as a stream. The output is also streamed in the standard output. The mexec script may optionally read (-d) or write (-w) to a database file or run completely in memory.

  5. Use madis as a python library and run SQL queries with UDFs importing “madis.py”:

    import madis
    

    madis package is used in the same way as sqlite3 package does. The only difference is that the executed queries may contain madIS UDFs and may be expressed in madIS extended SQL syntax.

  6. madIS also runs with PyPy (https://pypy.org) much faster. Just download the last version or a nightly build of PyPy (compatible with Python 2.7) and run pypy mterm.py without downloading and installing APSW. Several terminal features (history, auto-complete etc.) are not yet available with PyPy but it is still operational. madIS as a library and mexec script can be used without any limitation.