InterSystems IRIS DB-API Community Driver

GitHub release (latest by date)

Install

pip install https://github.com/intersystems-community/intersystems-irispython/releases/download/3.5.0/intersystems_iris-3.5.0-py3-none-any.whl

Examples

Connect to IRIS over network

import intersystems_iris.dbapi._DBAPI as dbapi

config = {
    "hostname": "localhost",
    "port": 1972,
    "namespace": "USER",
    "username": "_SYSTEM",
    "password": "SYS",
}

with dbapi.connect(**config) as conn:
    with conn.cursor() as cursor:
        cursor.execute("select ? as one, 2 as two", 1)   # second arg is parameter value
        for row in cursor:
            one, two = row
            print(f"one: {one}")
            print(f"two: {two}")

Connect to IRIS using embedded python mode. %Service_CallIn have to be enabled in IRIS

import intersystems_iris.dbapi._DBAPI as dbapi

config = {
    "embedded": True,
    "namespace": "USER",
}

with dbapi.connect(**config) as conn:
    with conn.cursor() as cursor:
        sql = "select ? as one, ? as two union all select ?, ?"
        params = [1, 2, 3, 4]
        cursor.execute(sql, params)
        for row in cursor:
            one, two = row
            print(f"one: {one}")
            print(f"two: {two}")

Used by

This project already used by several projects