Skip to content

intersystems-community/intersystems-irispython

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

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