intersystems-irispython 5.3.1
InterSystems IRIS Python SDK Kit
Requires Python: >=3.8

# intersystems-irispython [![PyPI version](https://img.shields.io/pypi/v/intersystems-irispython?logo=pypi)](https://pypi.org/project/intersystems-irispython/)

## Installation

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install intersystems-irispython.

```bash
pip install intersystems-irispython
```

## Usage

### Native Connections
```python
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("myGlobal", "hello world!") 

# 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

```python

# >>> On a native connection object "conn" <<<

# 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](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=BPYNAT_pyapi)

## Documentation

Full documentation is available at [InterSystems Native SDK for Python](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=PAGE_python_native)

## Help

For any issues you can contact [InterSystems Worldwide Response Center (WRC)](https://www.intersystems.com/resources/supporting-your-business-matters-intersystems-worldwide-response-center-wrc/)

## License

This project is licensed under the terms detailed at [https://www.intersystems.com/IERTU/](https://www.intersystems.com/IERTU/).

## Release Notes

#### Version 5.3.1
- Fixed an issue where fetching a lot of data would cause DB-API to hang.
- Fixed an issue where DB-API would return an `int` instead of a `bool` for a `%Boolean` type value.
- Fixed an issue where an exception would be raised if a stored procedure's `OUT` parameter had the value `0`.
- Stream references that were opened with DB-API are now automatically closed when the `Cursor` object is closed.
- Attempting an operation on a closed connection now raises an exception.
- Added support for Python 3.14.

#### Version 5.3.0
- Improved performance for fetching data with DB-API through the "read ahead" and "fast select" features. "Read ahead" is enabled by default and "fast select" can be enabled by setting the `featureOptions` connection parameter to `+1`.
- Fixed an issue with string to integer conversions that resulted in a `Data Error` instead of returning `0` for values like `+inf`, `-inf` or `NaN`.
- Fixed an issue with the precision of doubles/decimals while rounding.
- Fixed a typo in the error message for invalid port number.

#### Version 5.2.1
- Fixed an issue where using the default value for the `sharedmemory` parameter would prevent connections to remote hosts with SSL/TLS.
- Fixed an issue that caused a crash with a PEX shared connection.
- Improved error messages for issues with SSL/TLS connections.

#### Version 5.2.0
- Added support for the following to conform with the DB-API specification in [PEP 249](https://peps.python.org/pep-0249/):
  - Exceptions
  - Type Objects and Constructors
- Added support for Common Table Expression (CTE) parsing.
- `executemany()`: Fixed an error that did not allow the field value to be in a list or a tuple for an INSERT/UPDATE of multiple rows in a single column.
- Fixed an issue where executing a SQL statement to insert default values in a table would raise an exception.
- Fixed an issue where output redirection incorrectly displayed the value `None` for an empty string.
 
#### Version 5.1.2
- Updated the `rowcount` attribute to return `-1` if the `Cursor` object is closed.