Skip to content

Latest commit

 

History

History
65 lines (49 loc) · 2.13 KB

README.md

File metadata and controls

65 lines (49 loc) · 2.13 KB

InterSystems IRIS DB-API Community Driver

NOTE: This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.

GitHub release (latest by date)

Install

pip install https://github.com/intersystems-community/intersystems-irispython/releases/download/3.8.0/intersystems_iris-3.8.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