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:
- We’ve added several U2 BASIC API functions including:
We will delve into the BASIC APIs in “Python for the Rocket MultiValue Developer – Part 3 of 3 – Leveraging the Power of Python”