Python for the Rocket MultiValue Developer – Part 1 of 3 – An Introduction

Rocket Software has added support for the Python development language to Rocket® UniVerse 11.3.1 and Rocket® UniData 8.2, on Linux and Windows only. Python will also be added to Rocket® D3 in the second half of 2017.

Adding Python support gives experienced and new MultiValue developers the opportunity to code in one of the most popular development languages available today.  To help developers get started Rocket created a Python community page that hosts links to code samples, documentation and lots more.

Python in MultiValue – The Basics

Python now sits at the same level as the other access method used by the MultiValue developer.

Our MultiValue Python module consists of two parts.  The main access point for the Python developer is the u2py module, which is Python code.  The u2py module calls a module written in C.  Since both Python and the U2 databases are written in C, it is compatible and can be embedded into the database.

The entire box represents a single U2 server process.  A developer can choose to write an entire application in Python or U2 BASIC as well as writing parts of the application in either language.

The Python developer has access to the MultiValue Application Platform through the use of the u2py module, and the BASIC developer has access to Python through some new BASIC APIs.

The u2py Module

The installation of Rocket UniData and Rocket UniVerse includes Python (version 3.4.1).  The initial install of Python sets up the needed “.pth” file to point to the u2py module.  It is the u2py.py module that provides the interaction from Python to the MultiValue Application Platform.

The u2py module for Python, allows developers to interact with the MultiValue Application Platform in the following ways:

  • run U2 ECL/TCL commands
  • read/write U2 files
  • handle U2 dynamic arrays
  • manage U2 SELECT lists
  • call U2BASIC catalogued subroutines
  • control U2 transactions

We will delve into the u2py module in “Python for the Rocket MultiValue Developer – Part 2 of 3 – Getting Started with the u2py module”

BASIC APIs to access Python

Rocket UniData and UniVerse developers have access to Python through the following:

  • Two ECL/TCL commands RUNPY and PYTHON
    • RUNPY runs a Python program from TCL.
    • PYTHON launches Python’s interactive shell and can execute Python commands.
  • A new BASIC variable type, PYOBJECT is available.
    • PYOBJECT is used internally to receive a Python object.
  • Three new @variables:
    • @PYEXCEPTIONMSG
    • @PYEXCEPTIONTRACEBACK
    • @PYEXCEPTIONTYPE
  • We’ve added several U2 BASIC API functions including:
    • PyCall
    • PyCallFunction
    • PyCallMethod
    • PyGetAttr
    • PyImport
    • PySetAttr

We will delve into the BASIC APIs in “Python for the Rocket MultiValue Developer – Part 3 of 3 – Leveraging the Power of Python”

Michael Rajkowski

Michael Rajkowski 7 Posts

As a member of the Rocket MultiValue Support organization, Michael has worked with MultiValue for over 25 years in numerous professional roles. He is especially fascinated with the areas of MultiValue that intersect with other technologies. He recently moved to Irvine, where he can not only expand his MultiValue expertise to include the Rocket D3 product family, but also where he, his wife and son can enjoy being closer to Disneyland.

4 Comments

  • Gordon Reply

    March 27, 2018 at 12:53 pm

    Does this work on AIX now ? 3/2018

    • Mike Rajkowski

      Mike Rajkowski Reply

      April 11, 2018 at 10:31 am

      At this time it is just Linux and Windows, but is in the works. Note if you are interested in participating in the UniVerse Beta slated to start Q3, please contact Rocket Support, Product Management or your sales rep.

      • Thomas w VanKirk Reply

        June 12, 2018 at 10:54 am

        Mike,
        We would be interested in a beta for AIX for Unidata. Mascocabinetry, currently on Unidata 7.3.3

        • Michael Rajkowski

          Michael Rajkowski Reply

          June 13, 2018 at 8:02 am

          Thomas, I will pass your information to Product Management.

Leave a Comment

Your email address will not be published. Required fields are marked *