InterSystems IRIS Python SDK Kit
Actively maintained. Last release 10 days ago. A safe choice.
$
pip install intersystems-irispythonintersystems-irispython 
Installation
Use the package manager pip to install intersystems-irispython.
pip install intersystems-irispython
Usage
Native Connections
import iris
# Open a connection to the server
args = {
'hostname':'127.0.0.1',
'port': 1972,
'namespace':'USER',
'username':'username',
'password':'password'
}
conn = iris.connect(**args)
# Create an iris object
irispy = iris.createIRIS(conn)
# Create a global array in the USER namespace on the server
irispy.set("hello world!", "myGlobal")
# Read the value from the database and print it
print(irispy.get("myGlobal"))
# Delete the global array and terminate
irispy.kill("myGlobal")
conn.close()
Using DB-API
# Create a DB-API connection using the 'dbapi' module
import iris.dbapi
args = {
'hostname':'127.0.0.1',
'port': 1972,
'namespace':'USER',
'username':'username',
'password':'password'
}
conn = iris.dbapi.connect(**args)
# Create a cursor object
cursor = conn.cursor()
# Prepare and execute a SQL
cursor.execute("SELECT * FROM Sample.Person WHERE ID = 1")
# Fetch next row of a query result set
row = cursor.fetchone()
# Retrieve all column values of a row
values = row[:]
print(values)
# Close the cursor object
cursor.close()
More details on how to use DB-API can be found at Using the Python DB-API
Documentation
Full documentation is available at InterSystems Native SDK for Python
Help
For any issues you can contact InterSystems Worldwide Response Center (WRC)
License
This project is licensed under the terms detailed at https://www.intersystems.com/IERTU/.
Release Notes
Version 5.4.2
- Fixed an encoding issue when fetching data from an 8-bit InterSystems IRIS instance using DB-API.